SSH remote session management tool - screen tutorial

=

Pick up in the morning and evening: screen. Especially in a remote black box, there cannot be multiple tab windows, and it is easily broken.

=

SSH remote session management tool - screen tutorial

from:https://www.vpser.net/manage/screen.html

 

1. What is the screen command?

Screen is a full-screen window manager that can multiplex a physical terminal across multiple processes. There is a concept of session in Screen. Users can create multiple screen windows in a screen session, and in each screen window, it is like operating a real telnet/SSH connection window.

2. How to install the screen command?

Except for some streamlined systems or customized systems, most of the screen commands are installed. If not installed, the CentOS system can execute: yum install screen  ;

Debian/Ubuntu systems execute: apt-get install screen  .

3. How to use the screen command?

1. Commonly used methods

Used to solve the problems we encountered at the beginning of the article , such as when installing lnmp .

1.1 Create a screen session

You can execute: screen -S lnmp first  , and screen will create a session named lnmp. VPS Detective https://www.vpser.net/

1.2 Leave temporarily and keep the tasks or programs in the screen session

When you need to leave temporarily (the program in the session will not be closed, it is still running), you can use the shortcut key Ctrl+ad (that is, press and hold Ctrl, then press a, d in turn)

1.3 Restoring the screen session

When you come back, you can execute: screen -r lnmp  to restore the working interface of the lnmp session created before leaving. If you forgot, or did not specify the session name at the time, you can execute: screen -ls screen will list the current session list, as shown below:

11791.lnmp is the lnmp session created by the screen just now. It has temporarily exited the lnmp session, so the status is Detached. When screen -r lnmp is used, the status will become Attached. 11791 is the process ID of this screen session. Also works when resuming the session: screen -r 11791

1.4 Close the screen session

Execute: exit  , it will prompt: [screen is terminating], indicating that the screen session has been successfully exited. VPS Detective https://www.vpser.net/

2. Remote presentation

First, the presenter executes  screen -S test on the server to  create a screen session. The audience can link to the remote server and execute screen -x test  . The audience screen will appear and the presenter will be synchronized.

3. Common shortcut keys

Ctrl+ac : Create a window in the current screen session
Ctrl+aw : List of windows
Ctrl+an : Next window
Ctrl+ap : Previous window
Ctrl+a 0-9 : Between the 0th and 9th windows toggle

If you have any reason, you can leave a message below this article or post to https://bbs.vpser.net  .

>>Reprint please indicate the source: VPS Detective  Link to this article: https://www.vpser.net/manage/screen.html

 

 

=

=

=

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326004703&siteId=291194637