Wednesday, 14 October 2015

Remove file starting with dash [Linux]

What:

Linux

Problem:

You accidentally created file which starts with hyphen "-stubborn_file" and now you can't remove it.

Solution:

Let's say your file is in "/home/test/-stubborn_file".
Navigate to that directory and remove it as below.
cd /home/test/-stubborn_file
rm ./- stubborn_file
You can also use full path to do the same thing.
rm  /home/test/-stubborn_file

No comments:

Post a Comment