The Sreen command under Linux uses

Source: Internet
Author: User

For a detailed introduction, see: http://www.cnblogs.com/mchina/archive/2013/01/30/2880680.html

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.

    • Session Recovery
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.
    • Multi-window
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.
    • Session sharing
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 lines >][-r < job name >][-s][-s < job name;]

Parameter description

-A adjusts 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 attempt to recover the 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 the screen job is offline before recovery.
-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.

Three, commonly used screen parameters

Screen-s Yourname, a new session called Yourname
Screen-ls, List all current session
screen-r yourname back to yourname this session
screen-d yourname, remote detach a session
Screen-d-R yourname-> ends the current session and goes back to the yourname session

under each screen session, all commands start with Ctrl + A (C-A).
C-a? Show all key binding information
C-a C-Create a new window to run the shell and switch to that window
C-a N-Next, switch to the next window
C-a P---Previous, switch to the previous window
C-a 0..9, switch to the first 0..9 window
CTRL + A [Space], from Windows 0 sequential switch to Windows 9
C-a c-a, switching between the two most recently used Windows
C-a x, lock the current window and unlock it with the user's password
c-a D-Detach, temporarily leave the current session, the current screen session (may contain multiple windows) into the background to execute, and will return to the status of not yet in screen, at this time in the screen session, The process (either foreground/background) that runs within each window continues to execute, even if the logout is not affected.
C-a Z, put the current session in the background, and use the Shell's FG command to go back.
C-a W-Show All Windows list
C-a T-time, showing the current times, and the system's load
Kill window, C-a K, forcibly closes the current window
c-a [, enter copy mode, can be rolled back, searched, copied in copy mode as if using VI
C-b Backward,pageup
C-f Forward,pagedown
H (uppercase) high, move the cursor to the upper-left corner
L Low, move the cursor to the lower left corner
0 move to the beginning of the line
$ End of line
W forward one word, move forward in words
b Backward One word, move backward in words
Space is first pressed as the starting point for the marked area, and the second press is the end point
ESC ends Copy Mode
C-A], Paste, paste the content you just selected in copy mode

The steps to clean up and kill a screen are as follows:

Screen-ls

Here's 2092 is the current screen running PID value, if you do not see or worry can also use the following command:

Ps-e | grep screen

The next job is to kill the process:

Kill-92092

Here is a note of this screen is dead! The next job is remove the dead screen. Follow the prompts:

Screen-wipe

Finish ~

The Sreen command under Linux uses

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.