2

I understand that computers work faster if they don't have to output data to the user, so I'm wondering if there is a way to hide the printed lines in the Terminal, and eventually just print any errors.

Is that possible and would that make the OS run faster in anyway?

1 Answer 1

3

you can redirect STDOUT to /dev/null this will prevent printing output and only prints STDERR to your terminal.

You can use it like

yourfavouriteprogram > /dev/null

And yes, it is faster:

time head -100000 large_file.txt
real    0m16.570s
user    0m0.009s
sys     0m0.189s

time head -100000 large_file.txt > /dev/null
real    0m0.018s
user    0m0.014s
sys     0m0.004s
4
  • And how exactly should I put it in the command line? (Not a very experienced user)
    – Tr4kTr
    Aug 27, 2015 at 11:44
  • 1
    @Tr4kTr I edited my post. You just have to add > /dev/null at the end of your command
    – Wayne_Yux
    Aug 27, 2015 at 11:47
  • Way faster judging from the example
    – kos
    Aug 27, 2015 at 11:50
  • I am definitely going to use it in scripts. Never knew the difference was this big! Aug 27, 2015 at 11:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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