Monday, August 20, 2012

Delete a file whose name begins with a dash

Sometimes, you may find a file whose name begins with a dash. If you need to operate on the file, you may find that the filename may be interpreted as an argument to the command rather than the filename itself. This is problematic. To get around this problem, specify the path to the file. Use the following command to remove the file called -tmp.txt.

rm ./-tmp.txt

No comments: