screen技巧之重命名
作者:互联网
创建时取名
首先来说一下创建时取名的两种方法:
screen -S my_screen_name #创建新的会话,并取名 screen -R my_screen_name #如果已经有my_screen_name,则进入这个会话,如果没有则创建一个新的会话
当然创建时取名是最好的,但是有时候我们忘记取名了也可以用下面的方法。
Summary
C-a :sessionname mySessionName
Details
第一种方法是进入会话中操作
This is,
-
Attach to the session in question.
-
Press Ctrl+A.
-
Type
:sessionname mySessionName
– yes, the first colon is needed there, no extra spaces. -
Type Enter.
Example
$ screen -S foo [detached from 8890.foo] $ screen -ls There is a screen on: 8890.foo (22/12/11 18:39:22) (Detached) 1 Socket in /var/run/screen/S-user. $ screen -r Ctrl+A:sessionname bars [detached from 8890.bars] $ screen -ls There is a screen on: 8890.bars (22/12/11 18:39:21) (Detached) 1 Socket in /var/run/screen/S-user. $
Renaming without attaching
第二种方法是在会话外进行操作。
Screen's -X
switch lets you rename a session without attaching it.
$ screen -X sessionname foobars
$ screen -ls
There is a screen on:
8890.foobars (22/12/11 18:39:22) (Detached)
1 Socket in /var/run/screen/S-user.
$
Alternatively, you can specifically target a screen session by its existing name or id (useful if there are already multiple sessions):
$ screen -ls
There is a screen on:
8890.foo (02/23/2015 18:39:22) (Detached)
5136.barfoos (02/23/2015 18:39:22) (Detached)
1 Socket in /var/run/screen/S-user.
$ screen -S 8890.foo -X sessionname foobars
$ screen -ls
There is a screen on:
8890.foobars (02/23/2015 18:39:22) (Detached)
5136.barfoos (02/23/2015 18:39:22) (Detached)
1 Socket in /var/run/screen/S-user.
参考:https://superuser.com/a/370553/65975
# screen -S old_session_name -X sessionname new_session_name
标签:重命名,39,技巧,22,18,screen,8890,Detached 来源: https://www.cnblogs.com/ccfco/p/15307942.html