VPSADD tutorial: SSH remote session management tool-screen tutorial

888u

Last update at :2024-01-02,Edit by888u

VPSADD tutorial: SSH remote session management tool-screen tutorial

1. What is screen

Screen is a multi-window management program under Linux. When using telnet or SSH to remotely log in to Linux, if the connection is abnormally interrupted, the system will open a new session when reconnecting, and the original session cannot be restored. The screen command can solve this problem.

When using Telnet or SSH to remotely log in to Linux, if the connection is abnormally interrupted, the system will open a new session when reconnecting, and the original session cannot be restored. The screen command can solve this problem. The Screen tool is a terminal multiplexer, which essentially means you can run multiple terminal applications using a single terminal window.

2. How to install the screen command?

Except for some streamlined systems or customized systems, most of them have the screen command installed. If it is not installed, the CentOS system can execute: yum install screen;

Debian/Ubuntu system execution: 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 screen session

You can execute: screen -S lnmp first, and screen will create a session named lnmp.

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 and is still running), you can use the shortcut key Ctrl+a d (that is, hold down Ctrl and press a, d in sequence)

1.3 Restore 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 forget, or you did not specify a session name at the time, you can execute: screen -ls screen will list the currently existing session list, as shown below:

11791.lnmp is the lnmp session created by the screen just now. The lnmp session has been temporarily exited, so the status is Detached. When screen -r lnmp is used, the status will change to Attached. 11791 is the session of this screen. Process ID, which can also be used when restoring the session: screen -r 11791

1.4 Close screen session

Execute: exit, it will prompt: [screen is terminating], indicating that the screen session has been successfully exited.

2. Remote demonstration

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

3. Commonly used shortcut keys

Ctrl+a c: Create a window in the current screen session Ctrl+a w: window list Ctrl+a n: next window Ctrl+a p: Previous window Ctrl+a 0-9: Switch between the 0th window and the 9th window

4. Parameters -A Adjusts all windows to the size of the current terminal. -d Take the specified screen job offline. -h specifies the number of buffer lines in the window. -m Forcibly create a new screen job even if the screen job is currently in operation. -r Resume offline screen jobs. -R Try to resume offline jobs first. If no offline job is found, a new screen job is created. -s specifies the shell to be executed when creating a new window. -S Specifies the name of the screen job. -v Display version information. -x Restore previously offline screen jobs. -ls or –list Display all current screen jobs. -wipe Check all current screen jobs and delete screen jobs that are no longer available

Recommended site search: independent IP host, PHP space purchase, query IP address, rent virtual host, Hong Kong vpn server, how much does it cost to rent a server for one year, .net virtual host, PHP space recommendation, Hong Kong server defense, domain name price,

VPSADD tutorial: SSH remote session management tool-screen tutorial

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码