Delete Unix File with Special Characters
We keep getting this question on how to delete a file with special or strange or hidden characters very often. Lets take for example that you have a file with name "-file" or something like "*file" etc.
For any normal file, its important to take a back up of the file before any delete attempts are made. In particular we recommend the usage of command "rm -i" to allow for interactive prompt of the file name before being deleted.
Now to deleting files with special characters in its name..
Assume filename of the file you want to delete is "-file", then the command to execute is [code] rm -f '-file' [/code].
If you want to first move that file into a normal file name you can also use the mv command as [code] mv '*file' normalfile [/code]. Now you can use the normal rm command to remove the file.
Re: Delete Unix File with Special Characters
For deleting the Unix File Do Following:
1) Create a hard to delete file name.
2) Try to remove this file with rm command.
3) Remove file by an inode number, but first find out the file inode number.