Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 06-01-2005, 09:06 AM   #1
LQ Newbie
Registered: Jan 2005
Posts: 27

Rep: Reputation: 15
rm -rf a file starting with -

I have two files I want to get rid of, but they are


so when I try to

rm -rf -send.xml

I get

rm: invalid option -- s
Try `rm --help' for more information.

same problem with -.xml

I tried mv and I get

mv: invalid option -- .
Try `mv --help' for more information.

adding quotes doesn't help, I tried \-send.xml and that doesn't work.

How do you handle files that start with - ?
Old 06-01-2005, 09:10 AM   #2
Senior Member
Registered: Sep 2003
Location: Egypt
Distribution: Arch
Posts: 1,528

Rep: Reputation: 47
just add -- before the file

rm -rf -- -send.xml

its in man rm

To remove a file whose name starts with a `-', for example `-foo', use
one of these commands:

       rm -- -foo

       rm ./-foo

Last edited by heema; 06-01-2005 at 09:12 AM.


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
Starting X :cannot open shared object file DraaX Slackware 18 02-16-2005 08:54 AM
Terminal cmd for starting Matlab M-file editor without starting matlab fubzot Linux - Software 2 02-15-2005 06:49 AM
Deleting a file starting with a ? bitpicker Linux - General 6 11-24-2004 01:20 PM
Starting httpd: execvp: No such file or directory jules_fraser Linux - Software 2 01-18-2004 08:43 AM
Starting httpd: execvp: No such file or directory jules_fraser Linux - Networking 6 01-18-2004 06:36 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:51 PM.

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