Technical reprint from:VPS DetectiveAfter fruit cat finishing.For your convenience,
Common commands
screen -S XXXCreate a window.S must be capitalized, XXX is the window name
screen -r XXXRestore window.
screen -lsList all windows
Screen - D - r Kick off and restore the window
introduce
VPS DetectiveWhen I first came into contact with Linux, I was most afraid of SSH remote login Linux VPS compiling the installation program (such as installinglnmp)The network is suddenly disconnected or has to be disconnected from the remote SSH server due to other circumstances, and the remote command is also forced to stop. You can only reconnect and run again.It is believed that some VPSers have also encountered this problem. Today we will introduce a model to VPSersRemote Session Management Tools - Screen command。
1、 What is the screen command?
ScreenIt is a full screen window manager that can multiplex a physical terminal between multiple processes.Screen has the concept of session. Users can create multiple screen windows in one screen session, and each screen window is like operating a real telnet/SSH connection window.
2、 How do I install the screen command?
Except for some streamlined systems or customized systems, most of them have screen commands installed. If they are not installed, the CentOS system can execute:yum install screen ;
Debian/Ubuntu system execution:apt-get install screen 。
You can first execute:screen -S lnmpScreen will create a session named lnmp.VPS Detectivehttps://www.vpser.net/
1.2 Leave temporarily and keep the task or program 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, press Ctrl, and then press a, d)
1.3 Resume screen session
You can execute again when you return:screen -r lnmpYou can restore to the working interface of the lnmp session created before leaving.If you forget or do not specify a session name at that time, you can execute:screen -lsThe screen will list the existing sessions, as shown in the following figure:
11791.lnmp is the lnmp session created by the screen just now. At present, 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 process ID of the screen session. You can also use the following when recovering the session:screen -r 11791
1.4 Close screen session
Execution:exit, you will be prompted: [screen is terminating], indicating that you have successfully exited the screen session.VPS Detectivehttps://www.vpser.net/
2. Remote Demo
First, the presenter executes on the serverscreen -S testCreate a screen session, and the audience can link to the remote server to executescreen -x test Synchronization with the presenter will appear on the audience screen.
3. Common 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 window 0 and window 9
If you have any reason, you can leave a message below this article or go tohttps://bbs.vpser.netPost.
After reading and collecting, you can find it next time
label:
Copyright notice: This article is published based on the Knowledge Sharing Attribution - Sharing in the Same Way 3.0 Mainland China License Agreement. Please follow this agreement for reprinting
Article link:https://moe.xin/945.html[copy](Please indicate the source and link of this article when reprinting)