熱搜:win11繞過硬件限制安裝 一鍵重裝Win10系統(tǒng) 最干凈的u盤啟動盤 真正純凈版的win7系統(tǒng)
時間:2015-04-08 16:42:40 作者:qipeng 來源:系統(tǒng)之家 1. 掃描二維碼隨時看資訊 2. 請使用手機(jī)瀏覽器訪問: https://m.xitongzhijia.net/xtjc/20150408/44505.html 手機(jī)查看 評論 反饋
在進(jìn)行Linux多終端操作時,如果能夠?qū)崿F(xiàn)不同終端之間的同步,那么就能夠在各個終端上顯示相同的操作效果,能夠節(jié)省很多時間,操作方法也很簡單,下面小編就給大家介紹下Linux不同終端間同步的方法。
安裝必須軟件
#yum install tcl expect
。1)確認(rèn)當(dāng)前所在終端號:
。踨oot@localhost shell]# w
17:59:31 up 9:47, 5 users, load average: 0.06, 0.02, 0.00
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root tty3 - 08:15 9:44m 0.75s 0.75s 。/xrgsu -a
root tty1 :0 17:08 9:47m 9.41s 9.41s /usr/bin/Xorg :
root pts/0 :0.0 17:25 0.00s 3.04s 0.00s w
root pts/1 :0.0 17:33 10:04 0.11s 0.11s bash
root pts/3 :0.0 17:39 46.00s 0.02s 0.02s /bin/bash
(2)以root用戶身份向指定終端發(fā)起同步命令:
=========pts/0 向pts/1 發(fā)起操作========
。踨oot@localhost shell]# kibitz -tty pts/1 root
asking root to type: kibitz -4010
=========pts/1 收到請求 =============
。踨oot@localhost shell]#
Message from root@localhost.localdomain on pts/0 at 18:02 。。.
Can we talk? Run: kibitz -4010
EOF
。3)按回車,輸入 kibitz -4010
。踨oot@localhost shell]# kibitz -4010
Escape sequence is ^]
此時,pts/0 與pts/1兩個終端已同步,控制任何一個終端可以在兩邊顯示操作信息。
。4)再次查看終端狀態(tài)
[root@localhost shell]# w
18:06:10 up 9:54, 5 users, load average: 0.04, 0.02, 0.00
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root tty3 - 08:15 9:50m 0.76s 0.76s 。/xrgsu -a
root tty1 :0 17:08 9:54m 12.66s 12.66s /usr/bin/Xorg :
root pts/0 :0.0 17:25 1:58 5.41s 0.00s expect -- /usr/
root pts/1 :0.0 17:33 0.00s 0.11s 0.00s expect -- /usr/
root pts/3 :0.0 17:39 4:17 0.03s 0.03s /bin/bash
pts/0和pts/1已經(jīng)通過expect程序同步,pts/3沒有同步。
。5)讓3個以上終端同步
在pts/0或pts/1終端里向pts/3發(fā)起同步請求
。踨oot@localhost shell]# kibitz -tty pts/3 root
asking root to type: kibitz -4046
pts/3收到請求
。踨oot@localhost ~]#
Message from root@localhost.localdomain on pts/2 at 18:10 。。.
Can we talk? Run: kibitz -4046
EOF
。6)pts/3按回車,輸入 kibitz -4046
。踨oot@localhost ~]# kibitz -4046
Escape sequence is ^]
(7)再次查看終端狀態(tài),3個終端都已經(jīng)同步
。踨oot@localhost shell]# w
18:11:15 up 9:59, 5 users, load average: 0.01, 0.02, 0.00
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root tty3 - 08:15 9:55m 0.77s 0.77s 。/xrgsu -a
root tty1 :0 17:08 9:59m 14.51s 14.51s /usr/bin/Xorg :
root pts/0 :0.0 17:25 7:03 7.09s 0.01s expect -- /usr/
root pts/1 :0.0 17:33 1:08 0.11s 0.00s expect -- /usr/
root pts/3 :0.0 17:39 0.00s 0.03s 0.00s expect -- /usr/
相同的原理,即使使用遠(yuǎn)程登錄,不同的終端位于不同的主機(jī)上,一樣可以使用這樣的方法達(dá)到終端同步。
=============
man kibitz
kibitz - allow two people to interact with one shell
允許兩個用戶影響一個shell,即多終端同步
上面就是Linux多終端同步的方法介紹了,在同步之前,你需要先安裝軟件,然后輸入文字命令,從而實(shí)現(xiàn)Linux終端同步。
發(fā)表評論
共0條
評論就這些咯,讓大家也知道你的獨(dú)特見解
立即評論以上留言僅代表用戶個人觀點(diǎn),不代表系統(tǒng)之家立場