Saturday, May 4, 2024
10
rated 0 times [  10] [ 0]  / answers: 1 / hits: 15530  / 2 Years ago, mon, april 4, 2022, 5:45:47

I am looking for a way to send an executed command to a TTY terminal. For example, let us say that I open the gnome-terminal and on the window I type sudo aptitude update && sudo aptitude upgrade.



How can I send this to a TTY terminal instead of working with it in the TTY7 GUI environment?


More From » command-line

 Answers
6

I would recommend not doing that directly, but use a terminal multiplexer, such as tmux, as an in-between.



In the terminal that should receive the command start tmux with an identifier:



tmux new-session -s MYSES


Send commands to it with:



tmux send-keys -t MYSES "sudo aptitude update && sudo aptitude upgrade"$'
'

[#35255] Monday, April 4, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
doredtness

Total Points: 153
Total Questions: 113
Total Answers: 106

Location: South Georgia
Member since Fri, Nov 13, 2020
4 Years ago
;