Unix & Linux Asked by falky on October 14, 2020
Let’s say I have three Terminal windows open:
~
~/Desktop
~/test
. The current directory of the remote machine is ~/abcdef
Is it possible to execute a command that runs as if it were in one of the other open terminals, but prints the output in my currently active terminal.
For instance, from ttys001, can I get the output of ls
as if it were run in ttys002 and have it print in ttys001.
Can I also do the same for the remote machine I am connected to in ttys003 (ie get the output of ls ~/abcdef
not ls ~/test
.
Would be interesting in hearing how this would work for macOS and Linux.
Edit:
I am aware I am asking about "terminal windows" as opposed to the processes that are running in them. This is deliberate. The aim is to write a tool that can get the list of files/folders available to a user for each terminal window they have open. If a terminal window is actively SSH’d into another machine, then I’d like to get the files/folders in the working directory of the remote machine.
Have a look at tmux
or screen
.
You can attach multiple times to a "session", locally, remotely via ssh
, or in any other way you can start a shell on the machine in question.
Everything that happens in one session will be displayed on all attached terminals.
It is available for MacOS and Linux.
Correct answer by dirkt on October 14, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP