LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Removing a file named like a command flag (http://www.linuxquestions.org/questions/linux-general-1/removing-a-file-named-like-a-command-flag-467952/)

yuchai 07-26-2006 02:25 PM

Removing a file named like a command flag
 
I messed up on a tar command and ended up with a file named "--exclude=tmp"

When I try to use rm to remove it, it thinks the "--exclude=tmp" is a flag and gives me an error.

Code:

root@livingroom:/home/yuchai/backup/fileserve# ls -al
total 312200
-rw-r--r--  1 root  root  35549184 2006-07-26 15:08 --exclude=tmp
drwxr-xr-x  2 yuchai users      144 2006-07-26 15:15 .
drwxr-xr-x  3 yuchai users        49 2005-10-03 11:38 ..
-rw-r--r--  1 yuchai users  9637939 2005-10-03 13:27 backupetc.tar.gz
-rw-r--r--  1 yuchai users      776 2005-10-06 21:42 fstab
-rw-r--r--  1 yuchai users      1092 2005-10-03 11:38 lilo.conf
-rw-r--r--  1 yuchai users      1143 2005-10-06 21:42 local.conf
-rw-r--r--  1 root  root  274309120 2006-07-26 15:21 root.tar.bz2
-rw-r--r--  1 yuchai users      730 2005-10-03 11:46 smb.conf
-rw-r--r--  1 yuchai users    20140 2005-10-03 11:46 xorg.conf
root@livingroom:/home/yuchai/backup/fileserve# rm --exclude\=tmp
rm: unrecognized option `--exclude=tmp'
Try `rm --help' for more information.

How do I remove this file?

druuna 07-26-2006 02:32 PM

Hi,

As stated in the rm manpage:

rm -- --exclude=tmp

or

rm ./--exclude=tmp

Hope this helps.


All times are GMT -5. The time now is 09:46 PM.