Linux Tips:use screen to manage your session

How to install
//Yum
[root@nso ~]# yum -y install screen
//rpm
[root@nso ~]#wget http://mirror-hk.koddos.net/centos/7.8.2003/os/x86_64/
Packages/screen-4.1.0-0.25.20120314git3c2946.el7.x86_64.rpm
[root@nso ~]#rpm -ivh  screen-4.1.0-0.25.20120314git3c2946.el7.x86_64.rpm
Some Tips

Created a session, -S means special a name for that session.

[root@xuxing ~]# screen
[root@xuxing ~]# screen -S test  

Recover your session.

[root@xuxing ~]# screen -ls
There are screens on:
	15741.test	(Detached)
	5971.pts-2.xuxing	(Detached)
	4485.pts-2.xuxing	(Detached)
	4409.pts-0.xuxing	(Detached)
	25997.9922a	(Detached)
5 Sockets in /var/run/screen/S-root.
[root@xuxing ~]# screen -r test    // recover test session
[detached from 15741.test]

Detached session/Kill session

//使用组合键 C-a D  detach session
[root@xuxing ~]# screen -ls
There are screens on:
	15741.test	(Detached)
	5971.pts-2.xuxing	(Detached)
	4485.pts-2.xuxing	(Detached)
	4409.pts-0.xuxing	(Detached)
	25997.9922a	(Detached)
5 Sockets in /var/run/screen/S-root.

[root@xuxing ~]# kill -9 15741
[root@xuxing ~]# screen -ls
There are screens on:
	15741.test	(Dead ???)
	5971.pts-2.xuxing	(Detached)
	4485.pts-2.xuxing	(Detached)
	4409.pts-0.xuxing	(Detached)
	25997.9922a	(Detached)
Remove dead screens with 'screen -wipe'.
5 Sockets in /var/run/screen/S-root.

[root@xuxing ~]# screen -r test
There is a screen on:
	15741.test	(Dead ???)
Remove dead screens with 'screen -wipe'.
There is no screen to be resumed matching test.
[root@xuxing ~]# screen -wipe
There are screens on:
	15741.test	(Removed)
	5971.pts-2.xuxing	(Removed)
	4485.pts-2.xuxing	(Detached)
	4409.pts-0.xuxing	(Detached)
	25997.9922a	(Detached)
2 sockets wiped out.
3 Sockets in /var/run/screen/S-root.

[root@xuxing ~]# screen -ls
There are screens on:
	4485.pts-2.xuxing	(Detached)
	4409.pts-0.xuxing	(Detached)
	25997.9922a	(Detached)
3 Sockets in /var/run/screen/S-root.

[root@xuxing ~]# 

Tags:

           

No comments

Comments feed for this article

Reply

Your email address will not be published. Required fields are marked *