I am going to show you how to use job control on the common command 'tail -f /var/log/messages'. This command tracks new updates which have been added to the log file '/var/log/messages'. So whenever the log file '/var/log/messages' has been updated, it will print out the new lines that have been added, and it will output them directly to your terminal.
To run a job in the foreground just run the command like you normally would:
tail -f /var/log/messages
To run a job in the background, add '&' to the end of the command:
tail -f /var/log/messages &
The command will continue to run in the background, although its output will still be sent to the stdout of your current terminal, so you'll still see all the updates when they arrive, but you will be able to do other things, such as run other commands and browse around in the shell as normal.
You can output a list of running commands, both backgrounded and foregrounded jobs, by typing 'jobs'. This will show you the job number also, which is important.
When a job is running in the foreground, ie: through running a command normally, you can press Control-Z to suspend that command. It will be paused until you do something more with it. Once you have a job suspended, you can use the following two commands: 'fg' and 'bg'.
fg – sends the suspended command to the foreground, and resumes it so it executes normally
bg – sends the suspended command to the background, and resumes it so it executes normally
You can also foreground or background a certain job by job number, by appending '%1' to the end of the fg or bg command, ie: 'fg %5'.
To kill a command, type 'jobs', find out the job number, and then type 'kill %' and then the job number, ie:
That will stop the command, whether it is foregrounded or backgrounded.
Through these methods, you can have a large amount of commands running at once, and you can switch between them at will.