I've got a file called -T
on my linux box, and, I thought I could do
rm "-T"
or
rm "\-T"
or
rm \-T
or
rm *T
Alas, I've run out of simple tricks (or I'm misuing them).
I keep getting the error message:
rm: invalid option -- T
I'm pretty sure I could delete this file with some FTP client, but that feels like cheating. Can someone point me in the right direction?
A lot of *nix commands have a '--' option, which means "this is where the options end, anything from here onwards that looks like an option, isn't".
rm -- -filename
Not 100% sure if rm supports that, I'm a bit rusty.
Use the "--" option to tell rm that there are no more options coming.
You can also put a "./" in front of the file like this:
As a third option, you can often use a graphic file viewer and drag it into the trash.
Try prefixing your file with ./ I think this works.
I just had to try:
Put the current directory in front of the file name, which will prevent the program from thinking you're passing it a parameter.
-Kevin
Well, back in the day you could use ls -il or stat to print out the inode of the file then use find with an -inode flag and use -exec to call rm on that file!
I guess the post-early 90's are still calling me...... :)