Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am running Ubuntu, and would like to open a file whose file name starts with "-"(minus). When I try to open the file with pico or vim, the command thinks that the "-" sign is an option for the command.

I tried enclosing the file name with quotes ('), but I still get the same error.

I tried with bash and zsh, but still the same error.

share|improve this question
up vote 8 down vote accepted

In cases where command -- -file does not work - since not every program uses the same option parsing routines, command ./-file works everywhere.

share|improve this answer

Place -- just before file name. In Unix it indicates the end of options for command.

To be more concrete, use: vim -- -file.

share|improve this answer
Often, but not always, since it's left to the called command to interpret options however it prefers. For example, compare echo -n test and echo -- -n test. Check your manpages to be sure. – goldPseudo Mar 21 '10 at 5:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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