Advertisement
metalx1000

Linux Shell send text to another tty terminal

Feb 27th, 2017
1,055
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.44 KB | None | 0 0
  1. #redirecting output to another tty (teletype) or pts (pseudo-teletype)
  2.  
  3. #find out who is logged onto which terminal
  4. who -a
  5.  
  6. #now send text to that terminal
  7. echo "Hello World" > /dev/tty1
  8. #or
  9. echo "Hello World" > /dev/pts/1
  10.  
  11. #or send something more fun
  12. sudo apt install cmatrix fortune cowsay
  13. cmatrix > /dev/pts/2
  14. cowsay "Hello There" > /dev/pts/2
  15. fortune > /dev/pts/2
  16. cowsay "$(fortune)" > /dev/pts/2
  17. fortune|cowsay -f tux > /dev/pts/2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement