DelphiFAQ Home Search:
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.

Featured Article

How to remove a file with special characters in its name (space, semicolon, backslash)


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)?


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:
  1. putting the filename in quotes
  2. put a \ in front of each of the special characters
  3. 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.

# for files with ;
 rm "file;name"
 # to remove '-filename'
 rm "./-filename";

Generated 16:00:32 on May 30, 2020