|
Written by Martijn van Leeuwen
|
|
Tuesday, 05 May 2009 13:10 |
|
Most commands like ls are executed fast, but things like moving huge files occupy your terminal for quite a while. In these cases the job can be placed in the background, allowing you to execute other commands in the meantime.
While running a command (job) you can pause/suspend it with ctrl-z and kill it with ctrl-c.
| While running a job you can |
Shortcut |
| suspend a job |
ctrl -z |
| terminate a job |
ctrl -c |
When a job is suspended it can be moved back to the foreground with `fg` and placed in the background (where it will continue to execute) with `bg`.
| Function |
Command |
| Move a suspended job to the foreground |
fg |
| Continue a suspended job in the background |
bg |
| List all jobs |
jobs |
| Kill a job (%N where N is the job number) |
kill %N && fg |
| Start a job directly in the background |
command & |
How to run, suspend and continue a command in the background
|
|
Last Updated on Tuesday, 30 March 2010 13:28 |