Breadcrumbs 
Learning >> Documentation >> Jobs >> What a job is
 
Recent News
We're No 1!
We've reached the top! (Of Google!)
[ more ]
Firefox 3 Download Day
Firefox 3 has been officially released and is looking to set a world record for the most downloaded piece of software in 24hrs.
[ more ]
SSL Renewed
SSL cert has been renewed by the admin team.
[ more ]
What a job is
What a job is

Basically anything you run on a machine is a job. So whatever you have running in the terminal is a job. Something as simple as displaying a manual page, creating a talk session to another user or even checking your mail using mutt or pine are all jobs.

$ info

This creates a new job called info, which is part of the help system available for linux. Pressing the 'q' key will exit the program.

There's a section devoted to the info program so when you really feeling up to you can go read that, but for the moment we're just going to use it as part of the demonstration for explaining what a job is so don't worry about using it. If you get stuck just press the 'q' key a few times to get out of it.

In any case when you type in the command and press return the screen changes, info is the job displaying output to the window and as a result is regarded as the foreground job. Then any other jobs are regarded as background jobs.

Ctrl+Z
[1]+ Stopped              info

Pressing the above combination, explained further in the suspending jobs section, and then entering the command below should give a similar output on your screen. In this case the output to your screen will only be the job you just suspended.

$ jobs
[1]+ Stopped              info

Which brings us to the next important thing about jobs, they are each assigned there own unique id which allows them to be identified and also for additional arguements to be sent to them. The number inside the square brackets is the job number and knowing this allows us to do a few tricks. In this case the job number is 1.

With this job number we can use

$ %1

to go back to the job, the 1 being the job number. Also after the 1, additional arguments can be sent to the job, so if it supports being resumed, exited, etc this can all be done from the command line. I'm not going to give you a demostration because I can't think of any use for this.

Before we start the next section we need to jump back out of the info program so using the same key presses as before:

Ctrl+Z
[1]+ Stopped              info

And we return to the command line. Now lets learn how to suspend a job.