Visit Our UNIX and Linux User Community

Deleting a file without Prompt

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Deleting a file without Prompt
# 1  
Old 09-04-2009
Deleting a file without Prompt

Dear Members,

When i try to delete a file, i am getting a prompt which asks me to enter Y or N for deleting a file.

I should not get this prompt and it should delete the file.

How can we do this?

# 2  
Old 09-04-2009
rm -f filename

# 3  
Old 09-04-2009
If you are using rm, then use the -f flag.
rm -f somefile

# 4  
Old 09-05-2009
make sure rm is not aliased to something like "rm -i" by doing

type rm

If it is, you can bypass the alias by doing

/bin/rm file

# 5  
Old 09-05-2009
another way to bypass an alias is to prefix your command with a \
\rm filename


Previous Thread | Next Thread
Test Your Knowledge in Computers #933
Difficulty: Medium
Microcontrollers operating within embedded systems (such as the Raspberry Pi, Arduino, and other similar systems) always have internal hardware to keep track of time.
True or False?

10 More Discussions You Might Find Interesting

1. Solaris

Unable to move from rsc prompt to ok prompt

Hi, on sunfire v890 unable to move from rsc prompt to ok prompt, i have executed the command break. (9 Replies)
Discussion started by: manoj.solaris
9 Replies

2. Shell Programming and Scripting

Echo prompt and redirecting the output to a file

Hi Help, I have a script which looks like below. echo "Train count??" set train_count = $< cat tmp | awk -v var=${train_count} '{print $0"var"}' > tmp The echo "Train Count??" does not show up in the terminal due to redirecting to output file tmp. How is it possible to have the prompt... (3 Replies)
Discussion started by: Indra2011
3 Replies

3. UNIX for Dummies Questions & Answers

Deleting file basing on the timestamp substring in the file name

Hello, I have in my backup folder, files with names convention like this : randomFileNames_13-02-2014_23h13m09+1392333189 randomFileNames_14-02-2014_02h13m09+1392343989 randomFileNames_14-02-2014_04h13m09+1392351189 etc.... Base on timestamp at end of the filename, I would to delete all the... (7 Replies)
Discussion started by: thuyetti
7 Replies

4. UNIX for Dummies Questions & Answers

How to Change the % prompt to - prompt in UNIX?

how to Change the % prompt to - prompt in unix :wall: ---------- Post updated at 07:40 AM ---------- Previous update was at 07:38 AM ---------- How To display the last modification time of any file in unix ---------- Post updated at 07:40 AM ---------- Previous update was at 07:40 AM... (2 Replies)
Discussion started by: manjiri sawant
2 Replies

5. UNIX for Dummies Questions & Answers

Deleting a pattern in UNIX without deleting the entire line

Hi I have a file: r58778.3|SOURCES={KEY=f665931a...,fw,221-705}|ERRORS={16_1:T,30_1:T,56_1:C,57_1:T,59_1:A,101_1:A,115:-,158_1:C,186_1:A,204:-,271_1:T,305:-,350_1:C,368_1:G,442_1:C,472_1:G,477_1:A}|SOURCE_1="Contig_1092402550638"(f665931a359e36cea0976db191ff60ff09cc816e) I want to retain... (15 Replies)
Discussion started by: Alyaa
15 Replies

6. Shell Programming and Scripting

awk - writing matching pattern to a new file and deleting it from the current file

Hello , I have comma delimited file with over 20 fileds that i need to do some validations on. I have to check if certain fields are null and then write the line containing the null field into a new file and then delete the line from the current file. Can someone tell me how i could go... (2 Replies)
Discussion started by: goddevil
2 Replies

7. UNIX for Dummies Questions & Answers

RCS register a file without the prompt

Hi there, I'm very new to UNIX. I'm writing a script (tcsh / Solaris) in which a file is created and then it needs to be registered using RCS. The problem is that on running the command "ci -u myfile" I keep getting prompted to "enter description, terminated with single '.' or end of file:" ... (1 Reply)
Discussion started by: js8765
1 Replies

8. UNIX for Dummies Questions & Answers

Trimming a file from command prompt!

I have a text file. I want the top 100 lines of this file to be deleted that too from command line using minimum command input. Please tell! (1 Reply)
Discussion started by: nixhead
1 Replies

9. Shell Programming and Scripting

Expect, save to file and remove before prompt

I have an Expect script which works very well. It logs into my remote routers and runs some commands and then to the next until finished. I need two things, first I need to save the output to a file from where the log_user 1 begins. expect << EOF set timeout 15 #set var "exit " match_max... (1 Reply)
Discussion started by: numele
1 Replies

10. Shell Programming and Scripting

Deleting lines inside a file without opening the file

Hi, Just consider there are around 10 lines in a file. Now is it possible to delete the first 2 lines in the file without opening the file. No matter whatever the content of the file is, I just wanna delete the first 2 lines without opening the file. Is that possible? If so, please help me out.... (3 Replies)
Discussion started by: toms
3 Replies

Featured Tech Videos