一、检查系统是否安装有tcl和expect这2个软件包
[root@localhost:~]$ rpm -qa | grep tcl
tcl-8.4.7-2
tclx-8.3.5-4
[root@localhost:~]$ rpm -qa | grep expect
expect-5.42.1-1
二、检查是否有kibitz命令
[root@localhost:~]$ whereis kibitz
kibitz: /usr/bin/kibitz /usr/share/man/man1/kibitz.1.gz
三、查看当前登陆的2个用户
[root@localhost:~]$ w
21:45:10 up 1 day, 6:46, 3 users, load average: 0.52, 0.54, 0.45
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root tty1 – 30Dec08 36days 0.13s 0.13s -bash
root pts/0 192.168.1.44 21:37 0.00s 0.31s 0.04s w
root pts/1 192.168.1.44 21:45 3.00s 0.13s 0.13s -bash
可以看到2个登陆终端为 pts/0,另外一方为 pts/1
四、这时候,发起一方运行:
[root@localhost:~]$ kibitz -tty pts/1 root
asking root to type: kibitz -4517
在被邀请一方的终端上会出现以下提示:
[root@localhost:~]$
Message from root@localhost.localdomain on pts/0 at 21:46 …
Can we talk? Run: kibitz -4517
EOF
此时在被邀请方复制 kibitz -4517 在 EOF 后面,如下:
[root@localhost:~]$
Message from root@localhost.localdomain on pts/0 at 21:46 …
Can we talk? Run: kibitz -4517
EOF
kibitz -4517
Escape sequence is ^]
五、这个时候,就完成了共享同一个登陆shell的步骤,试着在一个终端下输入命令,可以看到另外一个终端显示一样的输出,而且是实时的,很不错哦!