You may not have noticed the powerful screen commands in Linux. The following describes the powerful screen commands in Linux. Because of the second generation sequencing analysis, it is often necessary to run a long time program. Because...
You may not have noticed the powerful screen commands in Linux. The following describes the powerful screen commands in Linux.
Because of the second generation sequencing analysis, it is often necessary to run a long time program. Because of the long time, there has been no good way. With screen, all of this will be solved. When you press the screen command, a single window running shell is created, where you can run the program you need.
It is easy to use screen. you only need to type screen in SHELL to open a screen session.
In each screen session, all commands start with ctrl + a (C-. Now let me briefly introduce the basic command C-ac-> Create to open a new window.
C-an-> Next, switch to the Next window
C-ap-> Previous, the Previous window
More ......
Less ...... C-aC-a-> Other, switch between two windows
C-aw-> Windows: list the windows enabled
C-a0-> switch to 0th windows
C-a1 ...... 9-> switch to 1st ...... 9 sort WC-aa-> issue C-a, in emacs, ve, bash, tcsh can be moved to the first C-at-> Time of the row, display the current Time, and the system load
C-aK (uppercase)-> killwindow, force disable the current windowC-a [-> to enter the copy mode. in the copy mode, you can roll back, search,
Copying is like using vi C-bBackward, PageUp
C-fForward, PageDown
H (uppercase) High: Move the cursor to the upper left corner
LLow: Move the cursor to the lower left corner
0 move to the beginning of the row
$ End of line
In normal mode:
Use screen-ls to view all screen sessions
Use screen-rsessionid to enter the specified screensession of sessionid.
Finally, exit and exit.
--------------------------------
In addition, when you start the background service or execute a script for a long time. Is it a sense that the interaction is poor,
Sometimes, if you want to output the result directly on the terminal, are you afraid that the terminal is closed accidentally and the process exits? (Some sshd services also set connection timeout and automatically exit the terminal)
The screen command can be used to solve the problem of running background services.
The command is actually super simple:
Directly input screen on the terminal. at this time, the server will start a new terminal, but this terminal is different from the previous normal terminal. it is not affiliated with the sshd process Group. in this way, when the local terminal is closed, the server terminal will not be killed.
Of course, there are more advantages than that. when you execute a task on the server terminal, you can even switch to the local terminal at any time to do other things. Then, when you want to go back, restore to the server terminal that has just been opened. if the task has not been completed, you can continue to execute the task.
Procedure:
First, enter the screen-Ssessionname terminal. (Sessionname is used to distinguish your session)
Press ctrl + a, and then press d to temporarily exit the terminal.
To return the result, first view the terminal process ID, screen-list
Or directly
Screen-rxx (sessionname) is enough.
Of course, after you have opened many sessions, you plan to close several sessions. after you enter the session, you can exit.
In general, screen can completely replace nohup and provide more complex functions, but I think those simple functions are enough to cope with daily operations.
Summary:
We hope that the powerful screen commands in Linux systems described in this article will be helpful to readers. more knowledge about Linux systems remains to be explored and learned by readers.
Author: IT Study Room"