This video is about interactive shell jobs.
So what is a job? When a user runs a command, this command is started as a foreground job.
And foreground job means that it occupies your terminal. You can't do anything anymore.
Users have some options to manage their own jobs, and the challenge with the
foreground job is that while it is running, the current console is occupied and
you might be interested in running a process in the background instead.
So if the process is already running, you can stop it using Control Z and then type the BG command to run it in the background.
You can also start a new process immediately in the background by using an ampersand behind the command.
And you can use Jobs to get an overview of currently running jobs.
And if there is one specific job that you want to move to the foreground, well,
you use FG to move it from the background to the foreground. Let me show you.
So I'm going to start a couple of jobs.
First job, sleep one hour.
Then we sleep for 10 minutes and we sleep for five minutes.
I'm doing that with the ampersand behind it because that runs them immediately in the background.
As you can see, there's also a Firefox job running in the background.
Well, you know what, I want to move that to the foreground FG1 and now
it is running in the foreground, which means that it's occupying my terminal. Doesn't mean
that I automatically see the graphical window that it starts, because that is elsewhere.
If I happen to not like that, well, I have choices. And one
choice is to Control Z&BG to continue running it in the background.
I can also put it in the foreground. So FG1 and Control C, that will
interrupt the job. As you can see now, all of these jobs are visible using
jobs, and this is about all that you can do to manage them.
As a user, you can always manage your own job. So if you want to make sure that your system is a little bit less
busy, you can kill all of these sleep jobs. Do I really want to do that? No, because it's not causing any harm anyway.