LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-06-2003, 07:08 AM   #1
chris2000g
LQ Newbie
 
Registered: Aug 2003
Posts: 5

Rep: Reputation: 0
delete a file called -n


I've created a file called "-n" (without quotes). How can I delete it?
 
Old 12-06-2003, 07:25 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
This is one solution:

rm ./-n
 
Old 12-06-2003, 07:26 AM   #3
ts_sudarshan
LQ Newbie
 
Registered: Oct 2003
Location: Bangalore
Distribution: Arch, SUSE OSS
Posts: 23

Rep: Reputation: 15
To delete the file -n; plz follow the following steps :

1) Go to the directory where the file resides in the terminal.
2) rm -n [this command is not possible as -n is treated as a parameter to rm which is invalid]

3) so, the solution is type:
rm ./-n
4) press 'y' without double quotes for the confirmation..
5) Bingo, it is gone.

It worked for me..
ATB
 
Old 12-06-2003, 07:28 AM   #4
vinay_s_s
Member
 
Registered: Jul 2003
Posts: 658

Rep: Reputation: 30
rm ./-n
that is it!

another way is
rm -- '-n'
the -- tells rm that '-n' is not an arg
 
Old 12-06-2003, 07:31 AM   #5
vinay_s_s
Member
 
Registered: Jul 2003
Posts: 658

Rep: Reputation: 30
Another tip:
if u want to delete a file by name "-n" with the quotes,
do this:

rm ./\"-n\"

(\" is like the escape sequence in C/C++)
 
Old 12-06-2003, 09:18 AM   #6
chris2000g
LQ Newbie
 
Registered: Aug 2003
Posts: 5

Original Poster
Rep: Reputation: 0
Thanks a lot!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the Linux file system called? gooshto Linux - Newbie 7 11-23-2005 08:14 PM
oops - made a file called "--dereference" - how do I delete it? BrianK Linux - General 2 06-21-2004 09:37 PM
Tried to delete file as root but it says I don't have permission to delete it! beejayzed Mandriva 23 03-12-2004 03:46 AM
How do you delete a file called "--tape-lengh=1"? I've tried everything... Huddlebum Linux - General 1 01-01-2004 11:11 PM
In which file the syslogd is called? zhu_liheng Linux - Newbie 2 10-01-2003 10:29 PM


All times are GMT -5. The time now is 04:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration