实验要求:最少两台服务器,而且这两台服务器属于同一台主机

 

先在两台服务器上用yum安装screen

yum install screen -y 

 

第一台服务器创建一个房间

screen -S +房间名

[root@localhost ~]# screen -S an
[root@localhost ~]# ls
anaconda-ks.cfg  Documents  initial-setup-ks.cfg  Pictures  Templates
Desktop          Downloads  Music                 Public    Videos
[root@localhost ~]#


 

第二台服务器查找screen的房间

screen -ls

[root@localhost ~]# screen -ls
There is a screen on:
 23233.an (Attached)
1 Socket in /var/run/screen/S-root.

 

找到第一台服务器创建的房间,第二台服务器加入第一台服务器创建的房间

联通以后,两台服务器就可以同步进行

screen -x +房间名

[root@localhost ~]# screen -x an

[root@localhost ~]# ls
anaconda-ks.cfg  Documents  initial-setup-ks.cfg  Pictures  Templates
Desktop          Downloads  Music                 Public    Videos
[root@localhost ~]#

 

在房间输入 exit 会退出并关闭房间


[root@localhost ~]# ls
anaconda-ks.cfg  Documents  initial-setup-ks.cfg  Pictures  Templates
Desktop          Downloads  Music                 Public    Videos
[root@localhost ~]# ^D
bash: : command not found...
[root@localhost ~]# ctrl +d
bash: ctrl: command not found...
[root@localhost ~]#
[root@localhost ~]# Ctrl+a
bash: Ctrl+a: command not found...
[root@localhost ~]# Ctrl+a
bash: Ctrl+a: command not found...
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# exit

[root@localhost ~]# screen -S an
[screen is terminating]
[root@localhost ~]#

注:这两台服务器必须在同一台主机