5

I ran dolphin like this:

dolphin . &

I see messages in the console like these:

QPixmap::scaled: Pixmap is a null pixmap

How can I keep the console clean or silent?

0

2 Answers 2

11

You can redirect the output to a file or to nowhere.

Using output redirection > you can redirect stdout and/or stderr away from the terminal.

To redirect stdout and stderr to a file use &> log.txt.

If you just want output to go way use &> /dev/null.

So you new command would be dolphin . &> /dev/null &

&> redirects all output

use > or 1> to redirect stdout only

use 2> to redirect stderr only

Note: if you want to append to a file rather than overwrite it use >> in place of >.

5
  • If one then wishes to close the terminal, it helps to also use nohup (although there are other options as well, such as screen).
    – Panther
    Jun 5, 2014 at 15:09
  • @dan08 a single & should come at the end of the entire command. Your examples with &> are incorrect. The OP's new commands should be dolphin . >/dev/null & which would get rid of just standard output. To ignore both stdout and stderr, the proper command is in Oli's reply. Jun 5, 2014 at 15:09
  • I've heard it both ways
    – Dan
    Jun 5, 2014 at 15:18
  • @InsomniacSoftware I would be curious as well, reference please. I am not doubting you or Oli, I would just like to educate myself.
    – Panther
    Jun 5, 2014 at 15:33
  • using just > only redirects stdout, but Oli added an extra 2>&1 to send stderr to stdout, so both get redirected by the redirect of stdout. @InsomniacSoftware the &> example is correct but I was wrong about &1> I edited to correct
    – Dan
    Jun 5, 2014 at 15:41
3

Redirect all the output into a black hole:

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

The 2, 1 and 0 (not used here) stand for STDERR (where all the error messages are sent), STDOUT (where normal output goes) and STDIN (where the input) comes from. In a normal terminal STDOUT and STDERR are both printed to screen.

The above example redirects STDOUT with > to /dev/null and then redirects STDERR into STDOUT so both output streams end up at /dev/null.

Not the answer you're looking for? Browse other questions tagged .