This article is a mirror article of machine translation, please click here to jump to the original article.

View: 15120|Reply: 2

[linux] Use screen to manage your remote sessions

[Copy link]
Posted on 6/26/2018 3:16:08 PM | | | |
System: CentOS 7.4 64-bit
Install the screen




grammar

options
-A Resizes all windows to the size of the current terminal.
-d <作业名称> Takes the specified screen job offline.
-h <行数> Specifies the number of buffer rows for the window.
-m Creates a new screen job even if it is currently in the job.
-r <作业名称> resumes offline screen jobs.
-R first tries to resume the offline job. If you can't find an offline job, create a new screen job.
-s Specifies the shell to be executed when creating a new window.
-S <作业名称> Specifies the name of the screen job.
-v Displays version information.
-x Resume the previously offline screen job.
-ls or --list displays all current screen jobs.
-wipe checks all current screen jobs and deletes screen jobs that are no longer available.

Common parameters



Under each screen session, all commands start with ctrl+a(C-a).




Type the screen command directly on the command line

Or so


Screen will create a full-screen window that executes the shell. You can execute any shell program as you would in an SSH window.Type exit in that window to exit the window, if this is the only window for that screen session, the screen session exits, otherwise the screen automatically switches to the previous window.

After that, we want to temporarily stop doing something else, like going out for a walk,Then type C-a d in the screen window, Screen will give a detached prompt.



View all sessions:


Reconnect the session:



If for some reason one of the sessions dies (e.g. the session is killed by man), the screen-list will show the session as dead. Use the screen -wipe command to clear the session


Close or kill windows

Normally, when you exit the last program in a window (usually bash), the window closes. Another way to close a window is to use C-a k, a shortcut that kills the current window and will also kill the processes running in the window.

If the last window in a screen session is closed, the entire screen session is exited and the screen process is terminated.








Previous:asp.net Run the 403 error solution
Next:Centos installation nginx-1.14.0 tutorial
 Landlord| Posted on 12/13/2018 9:31:37 AM |
--create a new session
screen -S test1

Ctrl+a+d #按Ctrl+a, and then press d to keep the Screen

If you kept the screen last time, you can view it using the command
[linux@user~]$ screen -ls
There is a screen on:
9649.test1   (Detached)


To restore the screen, use the command:
[linux@user~]$ screen -r test1 (or 9649)
 Landlord| Posted on 3/14/2025 8:56:39 AM |
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com