Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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 start a gui app from a konsole window and it writes out totally useless information. I do not need that. Is there a way to stop this, once and for all? I tried disown, doesnt help. I guess 2>&1 >/dev/null might help but that's rather tedious :(

Edit: OK, let's get creative. One half of the answer is to use preexec (I use zsh but the net is full of bash preexec tricks) and use ldd to detect libX11 (and what else?). Then http://stackoverflow.com/a/9188571/308851 shows how to create redirects to /dev/null. How can we expand this solution to work with programs having a shell script wrapper?

share|improve this question
see this, unix.stackexchange.com/questions/33383/… hope this helps :) – harish.venkat Dec 21 '12 at 9:36
up vote 3 down vote accepted

I know it's tedious but unless your app as a option to be executed in silence then I would go with

./app > /dev/null 2>&1

If you don't want to be always writing this that you can create your own alias in your shell profile.

.bashrc - for bash

you will need to create and alias:

alias app="/usr/local/bin/app > /dev/null 2>&1"

after updating your .bash_profile just relog or source ~/.bash_profile and just call the app.

EDIT: Correcting as per Michael comment, indeed the 2>&1 comes after the /dev/null. wonder if this is shell related.

share|improve this answer
This. But shouldn't it be >/dev/null 2>&1 (first redirect stdout, then redirect stderr to stdout)? – Michael Kjörling Dec 21 '12 at 9:40
To be honest, never tried like you have. I always redirect the stderr to stdout first and then redirect to where I want it to be So I always get the 2>&1 > <final_destination> – BitsOfNix Dec 21 '12 at 9:45
Maybe it works "as intended" these days. I do recall that this was an issue to be considered some time ago, at least. But then again, I might be mistaken about that. – Michael Kjörling Dec 21 '12 at 9:46
Don't put aliases in ~/.bash_profile, put them in ~/.bashrc and source ~/.bashrc from ~/.bash_profile, otherwise you will lose the aliases in non-login shells. – Chris Down Dec 21 '12 at 10:11
"I always redirect the stderr to stdout first and then redirect to where I want it to be." - that's not supposed to work: 2>&1 redirects stderr to the target of stdout right then, it doesn't tie them together. So if you do 'foo 2>&1 >somefile | bar', stdout should be piped to the next command. – FLHerne Mar 16 at 9:59

In zsh you can use &! -- that is,

gui-app --args --args &!
share|improve this answer
Just adding &! didn't work for me. – chx Jan 31 '13 at 8:44

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.