Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

When I read a script of makefile, I meet with the following linux script command:

mv obj/*.o .  2>/dev/null 

What does this command mean? I understand mv obj/*.o . means that all the files with suffix o in the obj folder will be moved to the current folder. What does 2> mean? When they are combined together, what is purpose? Thanks!

share|improve this question
up vote 3 down vote accepted

You're looking at output redirection (Bash). 2 stands for 'stderr', the error output. By redirecting it to /dev/null, you're discarding it to oblivion. Regular output, 'stdout' or 1 is still shown (in your terminal by default), though.

Basically, this is just silencing error output of the mv command.

A snippet from the above link explains it more general:

  # Redirect stdout to a file.
  # Creates the file if not present, otherwise overwrites it.

  ls -lR > dir-tree.list
  # Creates a file containing a listing of the directory tree.
  # Redirect stdout to file "filename."
  # Redirect and append stdout to file "filename."
  # Redirect stderr to file "filename."
  # Redirect and append stderr to file "filename."
  # Redirect both stdout and stderr to file "filename."
share|improve this answer

Btw, sometimes you might want to prevent displaying on the screen but might want to capture it on a file. If that's the case you might do something like this:

mv obj/*.o . > move.log 2>&1
share|improve this answer

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.