First, Introduction
GNU Screen is a free software developed by the GNU Program for command-line terminal switching. The software allows the user to connect multiple local or remote command lines simultaneously and freely switch between them.
GNU screen can be viewed as a command-line interface version of the window manager. It provides a unified interface for managing multiple sessions and corresponding functions.
-
as long as the screen itself is not terminated, the session running inside it can be resumed. This is particularly useful for users who log on remotely-even if the network connection is interrupted, the user will not lose control of the command line session that has already been opened. Once you log on to the host again, execute
screen-r to resume the session's operation. Also at the time of the temporary departure, you can perform separate command
detach, in order to ensure that the program inside the case of the normal operation of the screen hangs (switch to the background). This is similar to VNC under the graphical interface.
-
in the screen environment, all sessions run independently and have their own numbering, input, output, and window caches. The user can switch between different windows with shortcut keys, and can freely redirect the input and output of each window. Screen implements basic text operations, such as copy-and-paste, and also provides a scroll bar-like feature to view the history of the window's status. Windows can also be partitioned and named, and can also monitor the activity of background windows.
Screen allows
-
one or more users to log in to a session multiple times from different terminals and share all the features of the session (for example, you can see the exact same output). It also provides a mechanism for window access to password-protect windows.
GNU ' s screen official site: http://www.gnu.org/software/screen/
second, the grammar
screen [-AMRVX-ls -wipe][-d < job name >][-h < number of rows >][-r < job name >][-s][-s < job name;]
Parameter description
-A adjust all windows to the current size of the terminal. -D < job name > take the specified screen job offline. -H < number of rows > Specifies the number of buffer rows in the window. -m forces a new screen job to be established even if the screen job is currently in operation. -R < job name > restore Offline screen jobs. -R first attempts to recover an offline job. If you cannot find an offline job, create a new screen job. -s Specifies the shell to execute when a new window is created. -S < job name > Specifies the name of the screen job. -v displays version information. -x is offline before the screen job is restored. -ls or-list displays all of the current screen jobs. -wipe checks all current screen jobs and removes screen jobs that are not already available.
Third, session management
Under each screen session, all commands are started with CTRL + A (C-A)
C-A? -Show all key binding information C-A-CCreate a new window to run the shell and switch to the window C-A-NNext, switch to the next window C-A P-Previous, switch to the previous window C-A0..9Switch to Page0..9a Windowctrl+a [Space],sequential switch from Windows 0 to Windows 9C-A C-aSwitch between the two most recently used window C-A XLock the current window and use the user's password to unlock c-A-D, detach, temporarily leaves the current session, throws the current screen session (which may contain multiple windows) to the background and returns to the state when it is not yet in screen, at which time in the screen session, each WI Process within the Ndow (either front/background) are continuing, even if the logout is not affected. C-A-ZPut the current session in the background to execute, with the Shell's FG command can go back. C-AW-Show all Windows list C-T-time, showing the current times, and the system's load C-A KKillwindow, forcibly closes the current WINDOWC-A [Enter copy mode, you can roll back, search, and copy in copy mode as you would useVISame as C-b backward,pageup C-F forward,pagedown H (uppercase) high, move the cursor to the upper left L low, move the cursor to the lower left corner0move to the beginning of the line at the endWforward one word, move forward B backward one word in words, move back Space for the first time by the Mark area start, the second press the end point ESC to end copy mode C-A]-Paste, paste the content you just selected in copy mode
Iv. examples
1: Create a new Session:david
[Email protected] ~]# screen-s David
2: End the current session and return to the session Yourname
Screen-d-R yourname
Linux Screen Command