UNIX: Remove A File With A Name Starting With – (dash) Character
am a new Unix shell user at my university shell server. Accidentally, I had created a file called -foo
. Now, how do I remove a file with a name starting with '-
' under UNIX-like or Linux operating system?
You can use standard UNIX/Linux rm command
. All you have to do is instruct the rm command not to follow end of command line flags by passing double dash --
option before -foo
|Estimated completion time||1m|
rm command syntax
Use rm command to remove files or directories as follows:
rm -- -foo
Alternatively, you can also use UNIX / Linux inode number to delete a file with strange names. Facebook itGoogle+ itPDF itFound an error/typo on this page?