WEBVTT - This file was automatically generated by VIMEO

0
00:00:14.700 --> 00:00:17.500
Hello everyone and welcome

1
00:00:17.500 --> 00:00:18.300
 to this lesson.

2
00:00:19.100 --> 00:00:23.200
So in this video we are going to see how you can

3
00:00:22.200 --> 00:00:25.100
 start a process in the

4
00:00:25.100 --> 00:00:28.400
 background bring it to the foreground and how

5
00:00:28.400 --> 00:00:29.600
 you can kill that process.

6
00:00:30.500 --> 00:00:32.500
Perfect. So let's quickly begin.

7
00:00:33.500 --> 00:00:36.400
So to start a process in the background, we are

8
00:00:36.400 --> 00:00:39.600
 going to add m-person sign at the

9
00:00:39.600 --> 00:00:42.100
 end as you can see over here. So I'm going

10
00:00:42.100 --> 00:00:45.100
 to start a process which is nano and I want to

11
00:00:45.100 --> 00:00:48.900
 edit a file which is x y z and add and

12
00:00:48.900 --> 00:00:51.400
 at the end of the command

13
00:00:51.400 --> 00:00:54.400
 and you can see a new process ID has been

14
00:00:54.400 --> 00:00:57.900
 assigned to this which is two five eight

15
00:00:57.900 --> 00:00:58.300
 four.

16
00:00:59.200 --> 00:01:02.100
And you cannot see the Nano screen

17
00:01:02.100 --> 00:01:05.500
 over here because it is automatically pushed in

18
00:01:05.500 --> 00:01:07.500
 to the background. Perfect.

19
00:01:08.200 --> 00:01:12.700
So now we have our PID which is 2584. Let's

20
00:01:12.700 --> 00:01:15.400
 verify that using PS ox and let's

21
00:01:15.400 --> 00:01:18.600
 grab for Nano and you can see there is a process which

22
00:01:18.600 --> 00:01:22.900
 has been running which is 2584 PID

23
00:01:22.900 --> 00:01:25.700
 perfect. Now as we know this process has

24
00:01:25.700 --> 00:01:28.100
 been pushed to the background. So let's

25
00:01:28.100 --> 00:01:31.400
 verify that using the command BG and you can

26
00:01:31.400 --> 00:01:34.400
 see the process is running in the background and

27
00:01:34.400 --> 00:01:36.200
 the command is nano XY said

28
00:01:36.700 --> 00:01:40.100
in case you want to bring this process to foreground we

29
00:01:39.100 --> 00:01:42.500
 are going to use the command FG and

30
00:01:42.500 --> 00:01:45.300
 you can see the Nano terminal through which

31
00:01:45.300 --> 00:01:48.700
 you can add it. Now. This is very handy sometimes

32
00:01:48.700 --> 00:01:51.400
 in case you want to spawn a process push

33
00:01:51.400 --> 00:01:54.700
 it automatically into the background and at a

34
00:01:54.700 --> 00:01:57.600
 later point of time you want to resume the process or

35
00:01:57.600 --> 00:02:00.200
 resume your work and start editing it.

36
00:02:01.300 --> 00:02:03.800
Now this becomes very very useful and handy.

37
00:02:04.500 --> 00:02:07.300
Now, let's go back over here. And if

38
00:02:07.300 --> 00:02:10.400
 you want to kill the process that has been running

39
00:02:10.400 --> 00:02:13.800
 you do not need it anymore. So let's kill the

40
00:02:13.800 --> 00:02:16.200
 Nano process so kill and the

41
00:02:16.200 --> 00:02:19.200
 PID of the current process that has been running and hit

42
00:02:19.200 --> 00:02:22.600
 enter and you can see we have successfully killed the

43
00:02:22.600 --> 00:02:22.900
 process.

44
00:02:24.300 --> 00:02:27.800
So this is it for this video? I hope you guys understood how

45
00:02:27.800 --> 00:02:30.500
 you can push a process in

46
00:02:30.500 --> 00:02:33.800
 a background how you can bring it to foreground and

47
00:02:33.800 --> 00:02:36.200
 how you can kill it if you no longer

48
00:02:36.200 --> 00:02:36.800
 need it.

49
00:02:37.400 --> 00:02:37.800
Thank you.
