...making Linux just a little more fun!
Mulyadi Santosa [mulyadi.santosa at gmail.com]
Hi Gang...
here's the situation: Suppose I log on into server A twice using same user ID (let's say johndoe). Technically, Linux in server A will create two /dev/pts for johndoe, likely /dev/pts/0 and /dev/pts/1
Is there any way that for johndoe in pts/0 to read what the other johndoe type in pts/1? Possibly in real time? Initially I thought it could be done by using "history" command (in bash shell), but it failed.
Thanks in advance.
regards,
Mulyadi.
Robos [robos at muon.de]
Am 20.03.2009 10:49 Uhr, schrieb Mulyadi Santosa:
> Hi Gang...
Hi Mulyadi and list,
> here's the situation: > Suppose I log on into server A twice using same user ID (let's say > johndoe). Technically, Linux in server A will create two /dev/pts for > johndoe, likely /dev/pts/0 and /dev/pts/1 > > Is there any way that for johndoe in pts/0 to read what the other > johndoe type in pts/1? Possibly in real time? Initially I thought it > could be done by using "history" command (in bash shell), but it > failed.
Two solutions:
1) first login does: screen second login does: screen -xNow both see the same and can fight over who controls the keyboard
2) take a look at conspy, there you can also specify to only watch the other login.
Hope that helps,
regards
Robos
Ben Okopnik [ben at linuxgazette.net]
On Fri, Mar 20, 2009 at 04:49:50PM +0700, Mulyadi Santosa wrote:
> Hi Gang... > > here's the situation: > Suppose I log on into server A twice using same user ID (let's say > johndoe). Technically, Linux in server A will create two /dev/pts for > johndoe, likely /dev/pts/0 and /dev/pts/1 > > Is there any way that for johndoe in pts/0 to read what the other > johndoe type in pts/1? Possibly in real time? Initially I thought it > could be done by using "history" command (in bash shell), but it > failed.
Have you considered 'script'? From the manpage:
-f Flush output after each write. This is nice for telecooperation: One person does 'mkfifo foo; script -f foo' and another can supervise real-time what is being done using 'cat foo'.
...although I would just do 'script -f /tmp/foo' in one terminal and 'tail -f /tmp/foo' in the other one. Works great.
-- * Ben Okopnik * Editor-in-Chief, Linux Gazette * http://LinuxGazette.NET *
Kapil Hari Paranjape [kapil at imsc.res.in]
Hello,
On Fri, 20 Mar 2009, Robos wrote:
> Am 20.03.2009 10:49 Uhr, schrieb Mulyadi Santosa: > > Is there any way that for johndoe in pts/0 to read what the other > > johndoe type in pts/1? Possibly in real time? Initially I thought it > > could be done by using "history" command (in bash shell), but it > > failed.
> 2) take a look at conspy, there you can also specify to only watch the > other login.
'conspy' only works for the console. It does this via the /dev/vcsa devices which are the console devices and not the /dev/tty devices which are the tty devices associated with the console.
In addition to 'screen', this can also be achieved by 'ttysnoop' and more recently 'tmux'. In each case, the method by which 'johndoe' must "co-operate" with the snooping differs.
This all for "two-way" interaction. For one way interaction, you can use the solution proposed by Ben.
Regards,
Kapil. --