Saturday, May 7, 2022

[SOLVED] How can I echo to /dev/tty?

Issue

Is there a way to send something like an "end of data" after executing

echo "test" > /dev/tty1

in order to gain the "input cursor" back to "receiving" terminal (in this case tty1)?

Screenshot: http://picload.org/image/acdwigg/tty.png


Solution

Using echo > /dev/tty you can't achieve that. But you can do that by sending a signal to process which are using that tty.

For example:

kill -s SIGINT `ps -ft pts/2 | grep pts/2 | cut -d ' ' -f 5`


Answered By - Reishin
Answer Checked By - Terry (WPSolving Volunteer)