If the file you want to delete a character starting with "minus" (-), the rm command consider the following as part of the command line.
- To remedy this, one solution is to precede the filename of the command "--", indicating rm that there are more options beyond this:
rm -- -name-of-file-to-be-deleted
- A second solution is to escape the character "-" by preceding it with a backslash:
- A final solution is to give the full path or relative path beginning with. / and having the filename in quotes:
Thanks to Jeff for this tip.
- Linux - Deleting a file containing special characters
- Linux delete a line from a file - How-To - Sed
- Which key combination is used to permanently delete a file or folder - How-To - Keyboard
- How to delete multiple files on mac - How-To - MacOS
- How to delete unnecessary files in laptop tiktok - How-To - Hard Disk Drive
- Facebook special characters - How-To - Facebook
This document, titled « Linux - Deleting a file containing special characters », is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).