Screen command usage instructions in Linux

Source: Internet
Author: User
Tags switches terminates ssh

What is Screen command?
Screen is called a Full-screen window manager, which makes it easy to get multiple virtual terminals on a physical terminal.
Screen Feature Description:
In simple terms, screen is a window manager that can multiplex a physical terminal across multiple processes, which means you can use a single terminal window to run multiple terminal applications. Screen has the concept of a session, where users can create multiple screen windows in a screen session, as in each screens window, as in the case of a real telnet/ssh connection window.
Function Description:
When using Telnet or SSH to telnet to Linux, if the connection is disconnected abnormally, the system will open a new session and cannot restore the original Session.screen command to resolve the problem. The screen tool is a terminal multiplex, which in essence means that you can use a single terminal window to run multiple terminal applications.
Syntax
screen [-amrvx-ls-wipe][-d < job name >][-h < line >][-r < job name >][-s][-s < job name]
Supplementary Note:
Screen is a multiple Windows management program. The so-called window here refers to a Full-screen text-mode screen. The screen program is typically used only if you are using Telnet to log in to a host or use an old-fashioned terminal.
Parameters
-A adjusts all windows to the size of the current terminal.
-D < Job name > take the specified screen job offline.
-H < number of rows > The number of buffer lines for the specified window.
-M forces a new screen job to be created even if the screen job is currently in the job.
-R < Job name > Resume Offline screen job.
-R attempts to recover an offline job first. If you cannot find an offline job, create a new screen job.
-s Specifies the shell to be executed when a new window is created.
-S < job name > Specifies the name of the screen job.
-V Displays version information.
-X Offline screen job before recovery.
-ls or--list displays all current screen jobs.
-wipe checks all current screen jobs and deletes screen jobs that are no longer available.
Common screen Parameters:
Screen-s Yourname-> A new session called Yourname
Screen-ls-> Lists all current sessions
Screen-r yourname-> back to yourname this session
screen-d yourname-> Remote Detach a session
Screen-d-R yourname-> ends the current session and returns to Yourname
Under each screen session, all commands begin with Ctrl + A (C-A).
C-a? -> help, showing a simple description
C-a c-> Create, open a new window
C-a n-> Next, switch to next window
C-a p-> Previous, previous window
C-a 0..9-> switch to 0..9 window
CTRL + A [space]-> by window 0 sequential? Q to Window 9
C-a c-a-> Switch between the two most recently used Windows
C-a x-> Lock Current window, unlock with user password
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 screen is not in, at which time every The process (either foreground/background) running within the window continues to execute, even if the logout does not affect it.
C-a Z-> The current session to the background, using the shell's FG command? t can go back.
C-a w-> windows, listing windows that have been turned on have those
C-a t-> time, display current times, and system load
c-a K-> Kill window, forcibly closes the current window
c-a [-> into copy mode, in copy mode can be rolled back, search, copy like using VI
C-b Backward,pageup
C-f Forward,pagedown
H (upper case) high, move the cursor to the top 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, moving forward in Word units
b Backward one word, moving backward in words
Space for the first time as the mark of the starting point, the second press as the end point
ESC End Copy Mode
C-A]-> Paste, post the content just selected in copy mode
--end--


General usage of the screen command:
Screen-d-R: Connect a screen process, and if the process is attached, kick off the remote user before connecting.
Screen-d-R: Connect a screen process, and if the process is attached, kick off the remote user and let him logout reconnect
Screen-ls or-list: Displays the existing screen process, common commands
SCREEN-M: If you are in a screen process, you can create a new window by using the shortcut key Crtl+a C, or by simply playing screens, screen-m you will be able to make a newly created one.
SCREEN-DM: Create a new screen, and the default is the detached mode, which is not connected up after the building.
Screen-p number or name: Select a window in advance.
Screen to implement the background of the simple steps to run the program:
1> to do something, first use the command to create a screen:
[linux@user~]$ screen-s Test1
2> can then operate inside, and if your task is not finished, leave screen with the command:
[linux@user~]$ ctrl+a+d #按Ctrl +a, then press D to keep screen
[Detached] #这时会显示出这个提示, the instructions have been preserved screen
If you are finished working, enter directly:
[Linux@user~]$ Exit #这样就表示成功退出了
[Screen is terminating]
3> If you left screen last time, you can use the command to view:
[Linux@user~]$ Screen-ls
There is a screens on:
9649.test1 (Detached)
Restore screen and use the command:
[linux@user~]$ screen-r test1 (or 9649)
Shortcut keys used in the screen command
CTRL + A C: Create a window
CTRL + A W: List of Windows
CTRL + A N: Next window
CTRL + A P: Previous window
CTRL + a 0-9: Toggle between window No. 0 and 9th windows
CTRL + A (uppercase): Closes the current window and switches to the next window (when the last window is exited, the terminal terminates automatically and returns to the original Shell state)
Exit: Closes the current window and switches to the next window (when the last window is exited, the terminal terminates automatically and returns to the original Shell state)
CTRL + A D: Exits the current terminal, returns the shell command state before loading screen

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.