-   Linux - Newbie (
-   -   Unkown file! Help please! (

voyciz 01-26-2005 07:59 AM

Unkown file! Help please!
OK, for some reason I now have a file named "-f" in my home directory. I can't seem to remove it, I've tried "rm -f", "rm \-f", and "rm *f". This is a 77 byte file owned by root. If I use "ls *f" and it enter, it won't show up, but if I enter the same thing and keep hitting tab for auto-completion it will. Someone help. Does this mean someone's gotten in? Help please!

Linux~Powered 01-26-2005 08:13 AM


This is a 77 byte file owned by root.
As root try...


rm -rf yourfile

reddazz 01-26-2005 08:25 AM

I'd try to remove it, as root
#rm -rf *f
if there aren't any other files or directories that end with an f.

voyciz 01-26-2005 08:25 AM

No good. :(

voyciz 01-26-2005 08:37 AM

I used "file *f" and it made funny sounds and said "cannot allocate memory"...

LasseW 01-26-2005 09:48 AM


rm ./-f

ColKurtz 01-26-2005 10:05 AM

There might be a space in the filename, maybe before the dash? Try rm " -f" (there's a space before the dash there).

reddazz 01-26-2005 10:44 AM

How about trying to remove it using a file manager like Konqueror or nautilus?

wpn146 01-26-2005 11:11 AM

"rm ./-f" as stated above should work. The "./" will keep the "-f" from being considered an argument. If it doesn't work, there may be more funny characters in the file name, like trailing spaces. try an "ls -b" to display unprintable characters.

I once had a file named "*.*" in a Dos directory that was difficult to safely remove.

Padma 01-26-2005 11:13 AM

Try renaming it in Konq or Nautilus.

I seem to recall running into a similar problem many years ago. I was able to rename the file, and then I could properly delete it. :)

voyciz 01-26-2005 03:11 PM

It's gone! "rm ./-f" did it, thank you all. This will really help in the future, because I've had some other oddly named files that I had trouble with.

sulekha 08-13-2010 12:50 AM

try this
the solution i could find was

use rm -- argument to tell that everything that follows is a file name and not an option

ex:- rm -r -- -f

chrism01 08-13-2010 07:10 AM

The other trick is to cp out all other files in that dir, then rm -rf the dir .

brianL 08-13-2010 08:19 AM

Look at the date on the original post - it's a 5 year old thread. :)

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