screen 屏幕显示
Screen是一款用于命令行终端切换的自由软件。用户可以通过该软件同时连接多个本地或远程的命令行会话,并在其间自由切换。Screen可以看作是窗口管理器的命令行界面版本。它提供了统一的管理多个会话的界面和相应的功能。只要Screen本身没有终止,在其内部运行的会话都可以恢复。
- 在监控的hosts里查看本机的图形化,并添加屏幕
screen命令
[root@localhost ~]# yum -y install screen //下载screen
[root@localhost ~]# screen -t runtime //进入图形化界面,取名runtime
[root@localhost ~]# vim abc //编辑文件abc
~
//关闭页面,从新打开
[root@localhost ~]# ps -ef|grep vim //过滤下vim进程,还在运行
root 2789 2764 0 17:30 pts/1 00:00:00 vim abc
root 2832 2810 0 17:31 pts/0 00:00:00 grep --color=auto vim
[root@localhost ~]# screen -ls //查看套接字名字
There is a screen on:
2763.pts-0.localhost (Detached)
1 Socket in /run/screen/S-root.
[root@localhost ~]# screen -r 2763.pts-0.localhost //-r恢复进程
//回到了vim编辑abc里
nihao wuhan //编辑点内容
~
//不保存直接退出
//再恢复进程,页面还保持关闭没有保存的位置
[root@localhost ~]# screen -r 2763.pts-0.localhost
nihao wuhan
~
[root@localhost ~]# screen -d 2763.pts-0.localhost //-d表示删除
There is a screen on:
2763.pts-0.localhost (Detached)
There is no screen to be detached matching 2763.pts-0.localhost.
[root@localhost ~]# exit //表示直接退出,screen就会终止