Virtual screen tool that can be understood as a virtual terminal.
In order to interrupt a long-running script, two ways,
The first to drop the task into the background, the log output, Nohup command &, even if the terminal is disconnected, will also run in the background, but there is no way to see the task output in real-time screen.
The second one runs through the virtual terminal, screen. Allows the virtual terminal to run in the foreground or in the background. The W command is not visible.
[Email protected] ~]# screen[detached from 1951.pts-1.chy002]
First Run command screen, enter the virtual terminal, and then run the command, you can use CTRL + A + D to drop screen into the background.
View All Screen Listings
[[email protected] ~]# Screen-lsthere is a screens on: 1951.pts-1.chy002 (Detached) 1 Socket in/var/run/screen/s- Root.
Back to a screen
#后加虚拟终端号 [[email protected] ~]# Screen-r 1951
Create a custom name screen
[Email protected] ~]# screen-s "Test_screen" [detached from 1980.test_screen][[email protected] ~]# Screen-lsthere is S Creens on: 1980.test_screen (Detached) 1951.pts-1.chy002 (Detached) 2 Sockets in/var/run/screen/ S-root.
Linux if we want a task or program background execution can use &,linux also provides other task scheduling commands.
Bg
A command that pauses in the background changes to continue execution
Fg
Move commands in the background to the foreground to continue running
Jobs
See how many commands are currently running in the background
CTRL + Z
You can put a command that is executing in the foreground in the background and pause
Nohup command
Purpose: To run the command without hanging off.
Syntax: Nohup Command [Arg ...] [&]
Description: The nohup command runs commands specified by the command parameter and any related ARG parameters, ignoring all hang-up (SIGHUP) signals. Use the Nohup command to run a program in the background after logging off. To run the Nohup command in the background, add & (symbol representing "and") to the end of the command
Nohup
If you are running a process and you feel that the process will not end when you exit the account, you can use the Nohup command. This command can continue to run the appropriate process after you exit the account. Nohup is the meaning of not hanging (no hang up). The general form of the command is: Nohup Conmmand & If the job is submitted with the Nohup command, all output of the job is redirected to a file named Nohup.out by default, unless the output file is specified separately: nohup command > Myout.file 2>&1
In the example above, the output is redirected to the Myout.file file
Linux8.8 Screen Tool