Being able to master the use of background jobs in Linux is very important and is a great way to increase efficiency. Useful commands are outlined below.
When a job is currently running
- ctrl -z : suspend a job
[1]+ Stopped ./ExampleScript.sh
- ctrl -c : terminate a job
Job Management
- List all jobs e.g.
[1]+ Running ./ExampleScript.sh &
- Start a job in the background with <command> & e.g.
[1] 6460
- Kill job using kill %jobnumber e.g.
$ jobs
[1]+ Terminated ./ExampleScript.sh
For a suspended job
- Continue job in background : bg %jobnumber :
[1]+ ./ExampleScript.sh &
- Bring job to foreground : fg %jobnumber e.g.
./ExampleScript.sh
No comments:
Post a Comment