centos中screen的使用
只是讲解几个简单的操作,例如,创建新窗口,切换到新窗口,删除窗口。(因为我要启动elk,所以需要使用到screen)
一、创建一个新窗口:
安装完成后,直接敲命令screen就可以启动它。但是这样启动的screen会话没有名字,实践上推荐为每个screen会话取一个名字,方便分辨:
[root@elk-server ~]# screen -S elasticsearch [detached from 26000.elasticsearch] [root@elk-server ~]# screen -ls There is a screen on: 26000.elasticsearch (Detached) 1 Socket in /var/run/screen/S-root.
screen -S elasticsearch进入到新的窗口,直接按ctrl+a+d退出到原来的界面。
二、查看所有的窗口的ID和名称及登录其中窗口
[root@elk-server ~]# screen -ls
[root@elk-server ~]# screen -r -d elasticsearch
三、清除会话
[root@elk-server ~]# kill -9 26134 [root@elk-server ~]# screen -ls There are screens on: 26134.kibana (Dead ???) 26105.filebeat (Detached) 26027.logstash (Detached) 26000.elasticsearch (Detached) Remove dead screens with 'screen -wipe'. 4 Sockets in /var/run/screen/S-root. [root@elk-server ~]# screen -wipe There are screens on: 26134.kibana (Removed) 26105.filebeat (Detached) 26027.logstash (Detached) 26000.elasticsearch (Detached) 1 socket wiped out. 3 Sockets in /var/run/screen/S-root. [root@elk-server ~]# screen -ls There are screens on: 26105.filebeat (Detached) 26027.logstash (Detached) 26000.elasticsearch (Detached) 3 Sockets in /var/run/screen/S-root.