I have a command I am running produces a ton of output, I want to silence the output without writing to a file. I have used the following to send all output to a file, but again I don't want any file output:

command > out.txt 2>&1

I have used command > /dev/null on my CentOS box before, but I can't find a similar thing for windows.

link|improve this question
I hope you used command > /dev/null on your CentOS. – pipitas Aug 2 '10 at 20:43
@pipitas whatever i did it worked :D – Alec Gorge Aug 11 '10 at 18:19
If you indeed used command > /bin/null on CentOS, you have created a common file file named /bin/null on your system. You may say 'It worked!', if you want. This file now contains the stdout and stderr output of your command. Usually, in /bin/ there are only executable files. And usually, only the root user is allowed to create files there. So if that file is there, you did run your command as root user... /bin/null usually doesn't exist -- and /dev/null (which I mentioned) usually is used as the 'black whole' where unwanted output should disappear in... – pipitas Aug 11 '10 at 23:13
Good point, I hadn't thought of that. However, I am pretty sure it is just my faulty memory because I was on Windows at the time. – Alec Gorge Aug 18 '10 at 3:15
feedback

1 Answer

up vote 3 down vote accepted

You want command > NUL.

--jed

link|improve this answer
thanks! that works. I need to wait 12 minutes to accept the answer though (serverfault requirement)! – Alec Gorge Apr 16 '10 at 3:22
4  
This only redirects stdout. You also need > nul 2>&1 or 2> nul to kill stderr. – grawity Apr 16 '10 at 14:02
Yes I know that, but thanks for mentioning it for others that visit this question! – Alec Gorge Apr 19 '10 at 20:52
feedback

Your Answer

 
or
required, but never shown

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