Possible Duplicate:
Unix: Files starting with a dash, -

On my OSX (10.6.4) machine, I somehow managed to create a directory called "-v9" in the /var/root directory. How do I delete this directory?

Using the backslash to escape the minus doesn't seem to work:

# rm -r \-v9
rm: illegal option -- 9

Even using a wildcard won't work:

# rm -ri *9
rm: illegal option -- 9
usage: rm [-f | -i] [-dPRrvW] file ...
       unlink file

I tried to delete it using the Finder, but ran into a different problem. Because it's in the /var/root directory, the Finder won't display the contents of the folder. At least, it doesn't do this by default, and I don't know how to enable it (ditto for Path Finder).


rm -rf ./-v9 or rm -rf -- -v9


How about sudo rm -rf /var/root/-v9?

Alternatively, check out the HiddenFiles Widget, that let's you inspect the contents of hidden folders.


  1. I just found out Finder won't let you look in /var/root, due to permissions - it is owned by System.
  2. /var is actually a shortcut to /private/var, so the above bash command should probably read sudo rm -rf /private/var/root/-v9
  3. Use these suggestions at your own risk, by the way ;-)

Edit #2: If you use the absolute path to your folder, it doesn't matter that it starts with a '-' (at least on my mac). However, if you first cd into the relevant directory and type rm -rf -v9 then rm interprets the -v9 part as an (illegal) argument passed to it.


Not the answer you're looking for? Browse other questions tagged or ask your own question.