1 00:00:06,519 --> 00:00:08,630 This video is about interactive shell jobs. 2 00:00:09,630 --> 00:00:14,380 So what is a job? When a user runs a command, this command is started as a foreground job. 3 00:00:14,960 --> 00:00:18,850 And foreground job means that it occupies your terminal. You can't do anything anymore. 4 00:00:20,210 --> 00:00:24,913 Users have some options to manage their own jobs, and the challenge with the 5 00:00:24,913 --> 00:00:29,616 foreground job is that while it is running, the current console is occupied and 6 00:00:29,616 --> 00:00:34,320 you might be interested in running a process in the background instead. 7 00:00:34,960 --> 00:00:41,750 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. 8 00:00:42,969 --> 00:00:48,270 You can also start a new process immediately in the background by using an ampersand behind the command. 9 00:00:49,630 --> 00:00:53,179 And you can use Jobs to get an overview of currently running jobs. 10 00:00:54,020 --> 00:00:58,105 And if there is one specific job that you want to move to the foreground, well, 11 00:00:58,105 --> 00:01:02,189 you use FG to move it from the background to the foreground. Let me show you. 12 00:01:03,289 --> 00:01:05,170 So I'm going to start a couple of jobs. 13 00:01:09,269 --> 00:01:10,969 First job, sleep one hour. 14 00:01:12,109 --> 00:01:17,049 Then we sleep for 10 minutes and we sleep for five minutes. 15 00:01:18,269 --> 00:01:22,409 I'm doing that with the ampersand behind it because that runs them immediately in the background. 16 00:01:22,909 --> 00:01:26,560 As you can see, there's also a Firefox job running in the background. 17 00:01:27,079 --> 00:01:31,833 Well, you know what, I want to move that to the foreground FG1 and now 18 00:01:31,833 --> 00:01:36,586 it is running in the foreground, which means that it's occupying my terminal. Doesn't mean 19 00:01:36,586 --> 00:01:41,340 that I automatically see the graphical window that it starts, because that is elsewhere. 20 00:01:42,140 --> 00:01:46,515 If I happen to not like that, well, I have choices. And one 21 00:01:46,515 --> 00:01:50,890 choice is to Control Z&BG to continue running it in the background. 22 00:01:52,030 --> 00:01:57,613 I can also put it in the foreground. So FG1 and Control C, that will 23 00:01:57,613 --> 00:02:03,196 interrupt the job. As you can see now, all of these jobs are visible using 24 00:02:03,196 --> 00:02:08,780 jobs, and this is about all that you can do to manage them. 25 00:02:09,360 --> 00:02:15,610 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 26 00:02:15,610 --> 00:02:21,860 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.