Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

While looking around one of the servers at work I noticed that the application account I was logged into had an odd file in its home directory. The file was named "-rw-r-----.". This was obviously something that went wrong and I decided to remove it. However when doing the naive thing and simply running the following command results in an error...
 Command
$ rm "-rw-r-----."
rm: invalid option -- 'w'
Try `rm ./-rw-r-----.' to remove the file `-rw-r-----.'.
Try `rm --help' for more information.

rm___1.png


The issue arises because the file name starts with a dash character. The correct (and error free) way to remove such files is to use the -- command line argument with rm first like so...
 Command
$ rm -- -rw-r-----.

rm___2.png


No errors!



-i

A quick disclaimer...

Although I put in a great effort into researching all the topics I cover, mistakes can happen. Use of any information from my blog posts should be at own risk and I do not hold any liability towards any information misuse or damages caused by following any of my posts.

All content and opinions expressed on this Blog are my own and do not represent the opinions of my employer (Oracle). Use of any information contained in this blog post/article is subject to this disclaimer.
Hi! You can search my blog here ⤵
NOTE: (2022) This Blog is no longer maintained and I will not be answering any emails or comments.

I am now focusing on Atari Gamer.