How to use screen command in CentOS system? How to use screen command in CentOS system

Time:2020-7-30

Screen is a good thing. I’ve been using it these days. Screen is called a full screen window manager, which can easily get the effect of multiple virtual terminals on one physical terminal;

If you encounter some time-consuming programs, but you can’t always turn on the computer to observe him, you always have to turn off the computer after work and leave. Then screen will come in handy.

1. If you open a window in screencrt and run a program, the program will be destroyed automatically when you log off.

2. Use nohup to solve this problem, put the program in the background and check nohup.out You can see how the program is running, but if you use nohup to put the program in the background, you can no longer switch the program to the foreground, and screen can.

usage method:

1. Installation,CentOS is not installed by default. Please install it.

2. Enter the screen.

Enter screen and enter directly, and a new terminal will be entered. You can do long-running jobs.

3. Return to the main terminal (screen is still running in the background)

CTRL + A and then press D to display [detached]

4. Return to screen

screen -ls

There is a screen on:

18245.pts-1.imobile-sv006-200   (Detached)

1 Socket in /var/run/screen/S-root.

You can see all the screen sockets. You can use screen – R 18245 to return.

5. Exit screen completelyEnter exit on the screen terminal. The screen is terminating

6. Screen sharing and collaborative operation

One of the users, screen-s ipcpu, uses a named socket for easy input

Another user, screen – x ipcpu, can operate cooperatively, and the operation of one side will be displayed on the screen of the other side.

Other commands for screen

Help summary for each function of ctrl-a

Ctrl-a C creates a new window (terminal)

Ctrl-a, ctrl-n and ctrl-a, ctrl-p switch to the next or previous window

Ctrl-a ctrl-n n is a number from 0 to 9, which is used to switch to the corresponding window

Ctrl-a “gets a navigable list of all running Windows

Ctrl-a a clear wrong ctrl-a

Ctrl-a ctrl-d disconnects all sessions, and all tasks in the session run in the background

Lock the screen terminal with the password of ctrl-a x

===============================

Postscript

In the process of using screen, we often encounter the problem of “flashing screen”, which can be turned off.

Turn it off quickly: that is, enter Ctrl + a first and then Ctrl + G.

Permanent closure: modification/Etc / screenrc join

vbell off

In fact, this is very similar to the visual bell function in VI. To turn off the flash screen in VI, use the set noisualbell command.