In ubuntu, How to dedirect stdout and stderr to separate screens with dual monitors?

  • Do you want to do this on a command-line-only system, redirecting to different text-based virtual consoles displayed on two different monitors? Or is it sufficient to have two Terminal windows, one on one monitor and one on the other, run the command in one of them, and redirect stderr (or stdout) so it appears on the other? – Eliah Kagan Jun 1 '12 at 4:10
  • command-line-only system, with 2 monitors – linquize Jun 1 '12 at 6:21
  • Have you resolved this issue? – pl1nk Jun 24 '12 at 13:45

With terminals in desktop Ubuntu

  • Open a terminal and move it to the second monitor.

  • Type tty in that terminal, and you will get a response of the form /dev/pts/N, where N is a number (1, 2, ....)

  • Open another terminal on the first monitor. This is where you will run your commands

  • To redirect stderr to the other terminal:

    command 2>/dev/pts/N

  • e.g. try ls /askubuntu 2>dev/pts/N and you should see ls: cannot access /askubuntu: No such file or directory on the second terminal.

  • Replace 2 with 1 to redirect stdout instead.

This should work similarly for virtual consoles on a command-line system, with /dev/pts/N replaced by /dev/ttyNbut I haven't tested it. Pseudo-TTYs (e.g. ssh sessions) still use the /dev/pts/N syntax.

| improve this answer | |
  • The answer for desktop is fine – linquize Jun 1 '12 at 6:21

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.