Hello everyone and welcome
to this lesson.
So in this video we are going to see how you can
start a process in the
background bring it to the foreground and how
you can kill that process.
Perfect. So let's quickly begin.
So to start a process in the background, we are
going to add m-person sign at the
end as you can see over here. So I'm going
to start a process which is nano and I want to
edit a file which is x y z and add and
at the end of the command
and you can see a new process ID has been
assigned to this which is two five eight
four.
And you cannot see the Nano screen
over here because it is automatically pushed in
to the background. Perfect.
So now we have our PID which is 2584. Let's
verify that using PS ox and let's
grab for Nano and you can see there is a process which
has been running which is 2584 PID
perfect. Now as we know this process has
been pushed to the background. So let's
verify that using the command BG and you can
see the process is running in the background and
the command is nano XY said
in case you want to bring this process to foreground we
are going to use the command FG and
you can see the Nano terminal through which
you can add it. Now. This is very handy sometimes
in case you want to spawn a process push
it automatically into the background and at a
later point of time you want to resume the process or
resume your work and start editing it.
Now this becomes very very useful and handy.
Now, let's go back over here. And if
you want to kill the process that has been running
you do not need it anymore. So let's kill the
Nano process so kill and the
PID of the current process that has been running and hit
enter and you can see we have successfully killed the
process.
So this is it for this video? I hope you guys understood how
you can push a process in
a background how you can bring it to foreground and
how you can kill it if you no longer
need it.
Thank you.