一、screen 的建立
[root@90 ~]# screen -ls
No Sockets found in /var/run/screen/S-root.
[root@90 ~]# screen -dmS goaccess
[root@90 ~]# screen -ls
There is a screen on:
2228.goaccess (Detached)
1 Socket in /var/run/screen/S-root.
其中:2228是linux的ospid。goaccess是會話的名稱。
二、screen 的進入 screen參數(shù)請參考(http://www.itdecent.cn/p/7f248dc5d4c6)
[root@90 ~]# screen -r goaccess
三、暫時退出某個screen 的session :先按ctrl ,再按小寫的a,再按小寫的d
[root@90 ~]# screen -r goaccess
[detached]
[root@90 ~]#
四、若是本來就在該session中,再使用screen -r goaccess命令時的提示:
There is a screen on:
2228.goaccess (Attached)
There is no screen to be resumed matching goaccess.
[root@90 ~]#
screen -d ID 重新進去
五、狀態(tài)解釋:
[root@90 ~]# screen -dmS lei2
[root@90 ~]# screen -ls
There are screens on:
2228.goaccess (Attached) ---->有終端在連接會話。
2430.lei2 (Detached) ---->掛起狀態(tài),無終端在連接會話
2 Sockets in /var/run/screen/S-root.
[root@90 ~]#
六、永久退出screen中的本session
[root@90 ~]# exit
[screen is terminating]
查看下
[root@90 ~]# screen -ls
There is a screen on:
2430.lei2 (Detached)
1 Socket in /var/run/screen/S-root.
發(fā)現(xiàn)goaccess已經(jīng)結(jié)束了。
[root@90 ~]#
七、檢查screen中的其他session的來源ip:以下代碼為網(wǎng)絡(luò)尋找本人未作實驗
[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=ts/2 term=0 exit=0
root + pts/3 2015-03-19 22:33 . 5830 (192.168.80.1)
root + pts/4 2015-03-19 22:42 00:11 5851 (192.168.80.1:S.0)---->注意此處
[root@rhel63single ~]# screen -ls
There is a screen on:
5850.lei2 (Attached)
1 Socket in /var/run/screen/S-root.
[root@rhel63single ~]# ps -ef | grep 5851---->注意此處
root 5851 5850 0 22:33 pts/4 00:00:00 /bin/bash
root 5974 5830 0 22:56 pts/3 00:00:00 grep 5851
[root@rhel63single ~]# ps -ef | grep 5850---->注意此處
root 5850 1 0 22:33 ? 00:00:00 SCREEN -dmS lei2 ---->注意此處
root 5851 5850 0 22:33 pts/4 00:00:00 /bin/bash ---->注意此處
root 5883 5810 0 22:42 pts/2 00:00:00 screen -r 5850
[root@rhel63single ~]#
八、檢查當前的提示符是否處于screen的session中:
按ctrl,再按a,再按t
此時,在左下角會顯示:“22:45:06 Mar 19 rhel63single 0.00 0.00 0.00” 字樣
格式為:當前時間,日期,主機名,負載情況
九、殺掉screen中的其他session 個人實驗
[root@90 ~]# screen -ls 查看session ID
There is a screen on:
2430.lei2 (Detached)
1 Socket in /var/run/screen/S-root.
[root@90 ~]# kill -9 2430 殺掉進程
[root@90 ~]# screen -ls 查看進程狀態(tài)
There is a screen on:
2430.lei2 (Dead ???)
Remove dead screens with 'screen -wipe'. 提示使用screen -wipe 移除screens
1 Socket in /var/run/screen/S-root.
[root@90 ~]# screen -wipe 開始移除
There is a screen on:
2430.lei2 (Removed)
1 socket wiped out.
No Sockets found in /var/run/screen/S-root.
[root@90 ~]# screen -ls 查看移除狀態(tài)
No Sockets found in /var/run/screen/S-root.
[root@90 ~]#
然后,被殺掉的session 有提示: 網(wǎng)絡(luò)代碼 我的未顯示
[root@rhel63single ~]#
Suddenly the Dungeon collapses!! - You die...
[root@rhel63single ~]#