Linux shell 远程协助

 liunx shell   远程协助 ,允许两个shell 实时同步。(kibitz - allow two people to interact with one shell )
官方网址
http://linux.die.net/man/1/kibitz
安装 kibitz 需要的包有tcl  和expecet。
什么是tcl   http://www.tcl.tk/ 
Tcl (Tool Command Language) is a very powerful but easy to learn dynamic programming language, suitable for a very wide range of uses, including
 web and desktop applications, networking, administration, testing and many more. Open source and business-friendly, Tcl is a mature yet evolving
  language that is truly cross platform, easily deployed and highly extensible.
Tk is a graphical user interface toolkit that takes developing desktop applications to a higher level than conventional approaches. Tk is the stand
ard GUI not only for Tcl, but for many other dynamic languages, and can produce rich, native applications that run unchanged across Windows, Mac
 OS X, Linux and more.
什么是expect
 
 Expect是一个免费的编程工具语言,用来实现自动和交互式任务进行通信,而无需人的干预。Expect的作者Don Libes在1990年 开始编写Expect时对Expect做有如下定义:
Expect是一个用来实现自动交互功能的软件套件 (Expect [is a] software suite for automating interactive tools)。使用它系统管理员 的可以创建脚本用来实现对命
令或程序提供输入,而这些命令和程序是期望从终端(terminal)得到输入,一般来说这些输入都需要手工输入进行的。 Expect则可以根据程序的提示模拟标准输入提供给
程序需要的输入来实现交互程序执行。甚至可以实现实现简单的BBS聊天机器人。 :)
  Expect是不断发展的,随着时间的流逝,其功能越来越强大,已经成为系统管理员的的一个强大助手。Expect需要Tcl编程语言的支持,要在系统上运行Expect必须首先
安装Tcl。
 
[root@cobbler ~]# yum install  tcl expect
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.btte.net
 * epel: mirrors.ustc.edu.cn
 * extras: mirrors.btte.net
 * updates: mirrors.btte.net
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package expect.i386 0:5.43.0-5.1 set to be updated
---> Package tcl.i386 0:8.4.13-4.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================================================================================
 Package                          Arch                           Version                                   Repository                      Size
================================================================================================================================================
Installing:
 expect                           i386                           5.43.0-5.1                                base                           158 k
 tcl                              i386                           8.4.13-4.el5                              base                           956 k
Transaction Summary
================================================================================================================================================
Install      2 Package(s)        
Update       0 Package(s)        
Remove       0 Package(s)        
Total download size: 1.1 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): expect-5.43.0-5.1.i386.rpm                                                                                        | 158 kB     00:04    
(2/2): tcl-8.4.13-4.el5.i386.rpm                                                                                         | 956 kB     00:13    
------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                            60 kB/s | 1.1 MB     00:18    
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : tcl                                                                                                                      1/2
  Installing     : expect                                                                                                                   2/2
Installed:
  expect.i386 0:5.43.0-5.1                                                tcl.i386 0:8.4.13-4.el5                                              
Complete!

[root@cobbler ~]# whereis  kibitz
kibitz: /usr/bin/kibitz /usr/share/man/man1/kibitz.1.gz

怎么使用:运行 w 显示当前连接的情况
root@cobbler ~]# w
 16:38:27 up  2:14,  3 users,  load average: 0.00, 0.01, 0.00
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
root     tty2     -                14:27    2:11m  0.02s  0.02s -bash
root     pts/2    192.168.86.1     15:37    0.00s  0.03s  0.02s expect -- /usr/bin/kibitz -tty pts/6 zhangxx
zhangxx  pts/6    192.168.20.163   15:37   34:59   0.03s  0.02s expect -- /usr/bin/kibitz -6324
[root@cobbler ~]#
邀请人
[root@cobbler ~]# kibitz -tty pts/6  zhangxx
asking zhangxx to type:  kibitz -6566
Escape sequence is ^]
 另外一个shell 输入   kibitz -6566
 [zhangxx@cobbler ~]$
   Message from [email protected] on pts/2 at 16:39 ...
   Can we talk? Run: kibitz -6566
   EOF
   kibitz -6566
这样两个就可以实时了。

你可能感兴趣的:(Linux shell 远程协助)