Redirect stdout and stderr to separate screens with dual monitors

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.