centos中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.
posted @ 2018-08-15 12:44  ldp.im  阅读(1930)  评论(0编辑  收藏  举报