How to send output from one terminal to another without making any new pipe or file
If both terminals belong to the same user, you can send your output to the virtual device that is used as the particular terminal's tty.
So you can use the output from
w, which includes the TTY information, and write directly to that device.
ls > /dev/pts/7
(If the device mentioned by
w was pts/7)
Another option is to use the number of a process that is connected to that device. Send your output to
ls > /proc/5555/fd/1
Assuming the process number that you found that runs in that terminal is 5555.
Note that this direct write is only allowed if the user that attempts to write is the same user that owns the other terminal.
You can use
As @MelBurslan commented, if write permission is off, first execute:
$ mesg y
y Allow write access to your terminal.
Usage of write:
$ write username tty
ls output to other terminal.
$ w USER TTY FROM [email protected] IDLE JCPU PCPU WHAT user :0 :0 08:15 ?xdm? 7:37 0.25s init --user user pts/0 :0 08:19 1.00s 0.09s 0.01s w user pts/12 :0 08:50 54.00s 0.03s 0.03s bash $ ls | write username pts/12
I found a similar method.
On first terminal:
$ tty /dev/pts/0 $ <no need to run any command here, just see the output>
On second terminal:
$ ls > /dev/pts/0
Now you get the output on first terminal