Linux command: bg
Revision as of 22:46, 8 April 2015 by Rafahsolis (talk | contribs) (Protected "Linux command: bg" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)))
bg and &
If we add an & at the end of a command or script that we are executing it will execute in background
./my-shell-script.sh & [1] 10233
To pass a command that was executed in foreground to background without killing the process:
- Pause the process with CTRL + Z
$ ./my-shell-script.sh ^Z [2]+ Detenido my-shell-script.sh
Then unpause with:
$ bg [2]+ my-shell-script.sh &
This process can be brought back with fg command:
$ fg 2 my-shell-script.sh