Sunday, February 19, 2012

jobs–Linux Bash

jobs is a command that shows what all tasks are pending or working in background.  For example: you open a man page say ‘man lvcreate’ and close it by ‘ctrl+z’ key combo, then the actual man is not closed, but is running in background.

When we use ‘jobs’ we can see the running background tasks like this:

jobs

To bring the task foreground we need to use the command this way:

‘fg 1’ where 1 is the jobs number.

Then we can close the task with the application specific method like ‘q’, ‘esc’, ‘exit’ or ‘alt+f4’.  ‘q’ key is used to quit man pages.

To send the application or job back to background we need to use the ‘bg 1’ where 1 is the job number listed in ‘jobs’ output.

No comments:

Post a Comment