A command or process you run directly and wait for it to complete
The shell does not need to wait for the process to end. You can run as many of background process as you want within your system memory limit.
To run a background process, issue a command follow by an ampersand, the shell execute the command but instead of waiting, it return to the shell immediately.:
command &
Note background job run as lower priority compare to foreground job
- Ctrl + Z: suspend foreground process
- bg: resume suspended process in the background
- fg: resume suspended process In foreground
- jobs: see a list of suspended processes
- open vim and do whatever I need, save
:w
and suspend vim process usingCtrl-Z
in normal mode - do whatever I need in the shell, resume vim session by typing
fg
Normally I check the number of suspend vim I have by using jobs
command. I should onl have one suspended vim process.
https://www.lifewire.com/multitasking-background-foreground-process-2180219