fg, bg, jobs, &, nohup, ctrl+z, ctrl+c command
one, &
At the end of a command, you can put this command in the background, such as
? 1 watch -n 10 sh test.sh & # execute the test.sh script every 10s in the background
Second, ctrl + z< Br>
A command that is executing in the foreground can be placed in the background and paused.
3, jobs
See how many commands are currently running in the background
The jobs -l option displays the PIDs of all tasks. The status of jobs can be running, stopped, Terminated. But if the task is killed, the shell removes the process ID of the task from the list known to the current shell environment.
Four, fg
Move the commands in the background to the foreground to continue running. If there are multiple commands in the background, you can use fg %jobnumber (which is the command number, not the process number) to call the selected command.
Five, bg
Turns a command that is paused in the background into a background. If there are multiple commands in the background, you can use bg %jobnumber to call the selected command.
Sixth, kill
method 1: View the job number through the jobs command (assumed to be num), and then execute kill %num method 2: View the job number of the job (PID, assuming pid) through the ps command , then execute kill pid
termination of the foreground process: Ctrl+c
7. nohup
If the program is always executed in the background, even if the current terminal is closed (previous & Can't do it, this time you need nohup. This command can continue to run the corresponding process after you log out of the account/close the terminal. After closing the interrupt, the other terminal jobs can no longer see the background running program, then use ps (process view command)
? 1 ps -aux |
Grep "test.sh" #a: Display all programs u: Display x in user-based format: display all programs, not differentiated by terminal
End of process:
Background process Termination:
Transfer from: http://www.cnblogs.com/kaituorensheng/p/3980334.html
What is a process? A process is a running instance of an already launched executable. The process ha
1, role: list the contents of the directory; 2, format: ls [options] [files] [options] is
First, thread creation header file #include <pthread.h> function declaration int pth
How to install JDK graphic parsing in Ubuntu, for many friends who dont know how to operate,
Xinxing finishing Linux part of the commonly used command
How to view the diskspace hard disk application under linux
Understanding of packaging and compression in Linux
Character encoding and conversion tool for files under GnuLinux
Linuxarping command to test IP address conflicts
Under Linux, how can ordinary users temporarily obtain root privileges?
Microsoft closed the door to show Win10 Cortana and notification center function
Windows Server 2008 install DNS server detailed graphic tutorial
Windows7 forgot your login password? Experts can easily get it
Normal use of Vista shutdown function
Win10 how to enable setting administrator account
Will it take a long time for WeChat transfer to arrive? WeChat transfer to account time sharing