I honestly don't know how to phrase this but essentially here it is. I have a telnet session open on linux to my settop box. I was wondering if there is any way of executing a command on that session using another terminal session. or am i restricted to using only the open session?
You can use a Multiplexing Tool
For example, tools like tmux
or screen.
If the telnet session was started in a tmux
or screen
session, you can reattach to that session from another terminal.
If you haven’t started the telnet session yet, a good approach is to use tmux
or screen
so you can control the session from multiple terminals. If the session is already open, reattaching with these tools isn’t generally possible unless they were used initially.
I've done something which I think is similar.
E.g. have one XTerm window open and want to cause commands to be executed therein from a separate XTerm window.
I use the xdotool
from the 2nd XTerm to cause commands to be typed in the 1st XTerm window.
N.B. XTerm has a security option that I need to disable on the 1st XTerm window when I want to do this. -- I have to control click & hold to open the Main Options
menu, scroll down to Allow SendEvents
, and release to enable SendEvents.
xdotool
can target SendEvents to the 1st XTerm window.
My use case for this was a curses based application running in the 1st window w/ unfriendly command line editing ability. So I used scripts as commands in the 2nd window to send commands into the 1st window. It augmented the user interface and made the tool in the 1st window more friendly to use. Sort of a form of remote control of the 1st window from the 2nd window.