Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 write bash the output appear on th screen ....i don't want to display the command and the command output on screen how i can do it ?

share|improve this question
up vote 2 down vote accepted
somecommand &> /dev/null
share|improve this answer
thank you it is work ... but if you know how i can do this on windows CMD – Mohammad AL-Rawabdeh Oct 5 '10 at 7:48
somecommand > NUL, I think. – Ignacio Vazquez-Abrams Oct 5 '10 at 7:50
i try it but it is effect on the exit code (return value of the batch in windows) – Mohammad AL-Rawabdeh Oct 5 '10 at 8:03
@Osama: If you want to dump stderr as well as stdout, use something like somecommand > NUL 2>&1 -- This will redirect console output but the command will still populate %ERRORLEVEL% with exit code. – jscott Oct 5 '10 at 9:28
@jscott: When was FD redirection added to cmd.exe? – Ignacio Vazquez-Abrams Oct 5 '10 at 9:34

In windows, you can use NUL as in:

somecommand > NUL

(Please change the tags to reflect that this is actually a Windows, not unix/bash question)

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.