3月 172015
 
安装
 [root@localhost ~]# yum -y install screen

描述

linux-screen-usage-01

启动screen并运行top命令

 [root@localhost ~]# screen

linux-screen-usage-02

退出并保持当前screen会话
Ctrl+a+d

查看

[root@localhost ~]# screen -ls
 There is a screen on:
 16688.pts-4.localhost (Detached)
 1 Socket in /var/run/screen/S-root.

[root@localhost ~]#

激活screen会话
[root@localhost ~]# screen -r 16688

linux-screen-usage-03
打开多个screen会话窗口并在窗口间切换

Ctrl a c创建一个新窗口并运行vi编辑器

linux-screen-usage-04

Ctrl a c创建一个新窗口并运行htop

linux-screen-usage-05

使用Ctrl-a p上翻窗口
使用Ctrl-a n下翻窗口
使用Ctrl-a Ctrl-a在两个窗口间切换
使用窗口编号快速切换窗口
Ctrl-a 0-9

Ctrl-a c创建一个新窗口并使用Ctrl-a k杀掉当前窗口

linux-screen-usage-06
异常关闭的SSH连接及screen会话窗口的恢复

linux-screen-usage-07

-D (-r) Detach and logout remote (and reattach here).

linux-screen-usage-08

杀掉无法正常切换的screen会话进程

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

[root@localhost ~]# ps 16521
 PID TTY STAT TIME COMMAND
 16521 ? Ss 0:00 SCREEN
 [root@localhost ~]# kill -9 16521
 [root@localhost ~]# screen -ls
 There is a screen on:
 16521.pts-0.localhost (Dead ???)
 Remove dead screens with 'screen -wipe'.
 1 Socket in /var/run/screen/S-root.

[root@localhost ~]#

清除已杀死的screen会话进程

[root@localhost ~]# screen -wipe
 There is a screen on:
 16521.pts-0.localhost (Removed)
 1 socket wiped out.
 No Sockets found in /var/run/screen/S-root.

[root@localhost ~]# screen -ls
 No Sockets found in /var/run/screen/S-root.

[root@localhost ~]#

远程演示
screen -x
screen -x lesson1
screen -S lesson1

会话锁定和解锁 屏幕无显示但会接受键盘操作
锁定 Ctrl-a s 解锁Ctrl-a q

密码会话锁定
Ctrl-a x

linux-screen-usage-09

屏幕分割

 

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据