About this site
Links to us
General :: Linux :: shell
Linux shell programming/ scripting, shortcuts and general know-how.
This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.
Generated 12:00:33 on Jan 19, 2020
How to remove a file with special characters in its name (space, semicolon, backslash)
Question: I have a file with a semicolon in its name and cannot delete it. How can I delete a file with strange characters in its name (space, semicolon, backslash)?
Answer: In Unix you can string commands together with semicolons, so Unix will interpret a semicolon in a filename as a separator. You can try the following:
- putting the filename in quotes
- put a \ in front of each of the special characters
- if the filename starts with a special character e.g. '-', put a ./ in front of it
Finally you can try using an FTP client, ftp into that directory and issue an MDELETE command (short: mde). It will offer to delete all files - say 'no' in all cases except for the chosen one. That way you do not have to specify the file name.
|Most recent comments