Dave's Brain

Browse - Computer Tips - How do I remove a file that has a name starting with a dash?

Date: 2011mar3
OS: Linux

Q.  How do I remove a file that has a name starting with a dash?

A.  Use the full path or add ./ in front.
To remove a file called "-junk" do this:

rm ./-junk
Or
rm /full/path/to/file/-junk
This works for renaming, touching and copying too.

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.