function spy() {
ptsnum=`ps awfux | grep pt[s]\/"$1" | awk '/bas[h]/{print $2}'` ;
/usr/bin/strace -s 1000 -t -f -p $ptsnum 2>&1 3>&1 \
| grep -Poi 'write\(...\"[[:print:]]{1,2}\"[.][.][.][,]..\)' ;
}
[436] klikevil@epiphany ~ $ w<br>
09:36:43 up 12:06, 6 users, load average: 0.46, 0.29, 0.20<br>
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT<br>
klikevil pts/0 75.125.126.8 23:05 2:19m 10:33 0.18s cmd <br>
klikevil pts/1 75.125.126.8 00:18 6:50m 0.06s 0.04s sshd: klikevil [priv]<br>
klikevil tty7 :0 09:02 17:07m 2:02 0.32s x-session-manager<br>
klikevil pts/2 :0.0 09:03 3:30 0.08s 0.08s bash<br>
klikevil pts/3 :0.0 09:03 0.00s 0.76s 0.00s w<br>
klikevil pts/4 :0.0 09:06 3:13 0.46s 0.00s /bin/sh /usr/bin/thunder<br>
[437] klikevil@epiphany ~ $ spy 2<br>
write(2, "e"..., 1)<br>
write(2, "c"..., 1)<br>
write(2, "h"..., 1)<br>
write(2, "o"..., 1)<br>
write(2, " "..., 1)<br>
write(2, "s"..., 1)<br>
write(2, "u"..., 1)<br>
write(2, "p"..., 1)<br>
write(2, " "..., 1)<br>
write(2, "d"..., 1)<br>
write(2, "o"..., 1)<br>
write(2, "g"..., 1)<br>
write(2, "\n"..., 1)<br>
^C<br>
Sembra funzionare abbastanza bene se non ti dispiace ordinare un sacco di interruzioni di riga.
ttyrpld
sembra buono. raccomandato in questa domanda. serverfault.com/questions/40011/…