LinuxQuestions.org
Support LQ: Use code LQCO20 and save 20% on CrossOver Office
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 01-27-2005, 07:02 AM   #1
guillaume31
LQ Newbie
 
Registered: Jul 2004
Posts: 15

Rep: Reputation: 0
how to delete file which name start with minus sign?


I'm wondering how to delete a file created by error whose name start with a minus sign (such as "-b")?

------
rm -f "-b"
rm: invalid option -- b
Try `rm --help' for more information.
------

So far I used the graphic file manager to do it, but I'd to know if there is a way with the command line?

Many thanks in advance!
Guillaume

NB. Such a file can be easily created using emacs for instance
 
Old 01-27-2005, 07:11 AM   #2
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 53
Try this...
rm "./-b"
 
1 members found this post helpful.
Old 01-27-2005, 07:15 AM   #3
guillaume31
LQ Newbie
 
Registered: Jul 2004
Posts: 15

Original Poster
Rep: Reputation: 0
Works!!

Many thanks!!
 
Old 01-27-2005, 07:15 AM   #4
satinet
Senior Member
 
Registered: Feb 2004
Location: England
Distribution: Slackware 11, Sabayon 3.1
Posts: 1,463

Rep: Reputation: 46
Hello

cd to where the file is.

e.g. cd /tmp

then use:

rm ./-b to remove the file (in this example)

note the . before the /

Hey presto.
 
1 members found this post helpful.
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Try to start Knoppix but can't type equal sign jcksrobbins Linux - General 11 09-04-2009 10:33 PM
sign on invisible in gaim - NOT invi after sign on saravkrish Linux - Software 7 09-12-2005 10:55 PM
What is a SIGN File? giddyupman Linux - Software 1 09-28-2004 09:16 AM
Tried to delete file as root but it says I don't have permission to delete it! beejayzed Mandriva 23 03-12-2004 02:46 AM
how to sign a jar file on Linux moe2266 Linux - Newbie 1 01-23-2004 03:10 PM


All times are GMT -5. The time now is 03:38 AM.

Main Menu
 
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
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration