设为首页 加入收藏

TOP

Linux下screen命令的使用(一)
2015-11-21 01:31:51 来源: 作者: 【 】 浏览:0
Tags:Linux screen 命令 使用

刚刚才注意,默认情况下rhel6 是不安装screen命令的:

[root@rhel63single yum.repos.d]# yum install screen
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
rhel-source                                                                                                                          | 4.0 kB     00:00 ... 
rhel-source-beta                                                                                                                     | 4.0 kB     00:00 ... 
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package screen.x86_64 0:4.0.3-16.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================
 Package                           Arch                              Version                                   Repository                              Size
============================================================================================================================================================
Installing:
 screen                            x86_64                            4.0.3-16.el6                              rhel-source                            494 k

Transaction Summary
============================================================================================================================================================
Install       1 Package(s)

Total download size: 494 k
Installed size: 795 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : screen-4.0.3-16.el6.x86_64                                                                                                                          1/1 
Installed products updated.
  Verifying  : screen-4.0.3-16.el6.x86_64                                                                                                                          1/1 

Installed:
  screen.x86_64 0:4.0.3-16.el6                                                                                                                                         

Complete!
[root@rhel63single yum.repos.d]# which screen
/usr/bin/screen
[root@rhel63single yum.repos.d]# 


一、screen 的建立

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

[root@rhel63single ~]# 
[root@rhel63single ~]# 
[root@rhel63single ~]# screen -dmS lei1
[root@rhel63single ~]# screen -ls
There is a screen on:
        5786.lei1       (Detached)
1 Socket in /var/run/screen/S-root.

[root@rhel63single ~]#
其中:5786是linux的ospid。lei1是会话的名称。


二、screen 的进入

[root@rhel63single ~]# screen -r lei1


三、暂时退出某个screen 的session :先按ctrl ,再按小写的a,再按小写的d

[root@rhel63single ~]# 


            
[detached]
[root@rhel63single ~]# 


四、若是本来就在该session中,再使用screen -r lei1命令时的提示:

[root@rhel63single ~]# screen -r lei  或者用screen -r 5786
There is a screen on:
        5786.lei1       (Attached)
There is no screen to be resumed matching lei.
[root@rhel63single ~]# 

五、状态解释:

[root@rhel63single ~]# screen -dmS lei2
[root@rhel63single ~]# 
[root@rhel63single ~]# 
[root@rhel63single ~]# 
[root@rhel63single ~]# screen -ls
There are screens on:
        5850.lei2       (Detached)---->挂起状态,无终端在连接会话
        5786.lei1       (Attached)---->有终端在连接会话。
2 Sockets in /var/run/screen/S-root.

[root@rhel63single ~]# 

六、永久退出screen中的本session

[root@rhel63single ~]# exit
                           exit


                        
[screen is terminating]
[root@rhel63single ~]# screen -ls
There is a screen on:
        5850.lei2       (Detached)
1 Socket in /var/run/screen/S-root.

 


七、检查screen中的其他session的来源ip:

[root@rhel63single ~]# who -a
           system boot  2015-03-19 12:36
           run-level 5  2015-03-19 12:36
LOGIN      tty2         2015-03-19 12:37              1979 id=2
LOGIN      tty4         2015-03-19 12:37              1983 id=4
LOGIN      tty3         2015-03-19 12:37              1981 id=3
LOGIN      tty5         2015-03-19 12:37              1985 id=5
LOGIN      tty6         2015-03-19 12:37              1987 id=6
root     + pts/0        2015-03-19 19:05 00:17        5306 (192.168.80.1)
           pts/1        2015-03-19 22:29              5787 id=/1    term=0 exit=0
           pts/2        2015-03-19 22:33              5810 id
首页 上一页 1 2 下一页 尾页 1/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇《Redis设计与实现》学习笔记-Lua.. 下一篇Mycat水平分表,垂直分表实践(2)

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: