Linux command: bg
Revision as of 22:46, 8 April 2015 by Rafahsolis (talk | contribs) (Created page with "bg and & If we add an & at the end of a command or script that we are executing it will execute in background<br /> ./my-shell-script.sh & [1] 10233 To pass a command that...")
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