Live Chat!

Remove file start with special character

          0 votos

December 5th, 2006 mysurface Posted in Common, mv, rm, touch | Hits: 10416 |

In linux, file can be any name, including “–testing”. If you have a file with this name, how you delete it?

Command line bellow will fail,

rm --testing

The correct one is

rm ./--testing

This works for mv, cp etc. So you can actually create a file with name “–testing” using touch.

touch ./--testing

3 Responses to “Remove file start with special character”

  1. Alternatively, you can use

    rm -- --testing
    touch -- --testing
  2. [...] Sometimes, you may find some file you can’t delete because of the filename begins with minus(-). LBE have that example on the post “Remove file start with special character”, as simple as this [...]

  3. [...] Remove file start with special character [...]

Leave a Reply