For some stupid reason I used a series of stupid switches and created this file, now can't seem to get rm to believe it's a file and not a switch
Yeah, I know, I know, but seriously, how do I delete it?
For some stupid reason I used a series of stupid switches and created this file, now can't seem to get rm to believe it's a file and not a switch
Yeah, I know, I know, but seriously, how do I delete it?
Reminds me of the stories I heard of line errors on ancient teletypes creating bizarre filenames.. I couldn't understand how until someone mentioned >'s appearing in the wrong place.
Most commands take the --
option to convince them to take any following arguments literally, rm -- --weirfilename
You could also prepend it with an absolute or relative path, rm /path/to/--file
or rm ./--file
absolute path worked, thanks
You might want to use wildcards together with the -i flag: rm -i *log-file
.
You could also use the i-node:-
ls -li | grep log-file
The first column is the i-node, then you can do this:-
find . -inum inum -exec rm {} \;
Just another way if the others don't. It can be very good for removing files with space in them too.
Robin
Robin