2

I'm trying to remove a file I made by mistake using --exclude with tar. I ended up making a tar file named --exclude=*.tar Now I want to delete it but I'd like to rename it first. How do I escape it correctly?

Monty
  • 225
  • 2
  • 6

2 Answers2

2

There are two straightforward ways to do this using just rm:

rm -- --exclude=*.tar

or

rm ./--exclude=*.tar 
0

I just used mv ./--exclude=*.tar deleteThisFile and that worked fine.

Monty
  • 225
  • 2
  • 6
  • I think the only things you ever need to escape are spaces (if you don't quote) or quotes (if you do quote). – goldilocks Nov 15 '13 at 19:10