So, what we're gonna do to see the entire list is use a command called "ps aux" this captures data at
the time that you run that command, but you can the list is quite a bit
larger. We can go through and look for applications that we want to see, but
this can get a little you know convoluted just because of how large this list can
be. So, I'm gonna run liri browser here and when it opens this is now a process
that is running. So, I can find any liri browser processes by typing "ps aux"
and we can pipe that over to the command "grep" and we can look for "liri-browser"
and it's going to search for all processes that have liri browser
anywhere in it, so the name of command or the file path of the command it doesn't
matter, it's gonna find it based on that name. Now that's pretty neat. It gives us
a few things, it gives us the process ID, and the time running, and the command,
and stuff like that, and it also gives the time that it was run. So, we could use
this process ID to manage whether this app is running or not, but let's say
we've got a few instances running. So, now have three processes for the liri browser. So, what
happens when I run the previous command? It's messy, you could read through this and
if you want to, but if you just want to have a quick look at it
this is not the command. If you want to get the process IDs
of an application you can use the "pgrep" command and type in "liri-browser" and this is gonna
return three process IDs because we've got three processes running. The order of
these process IDs is chronological, so the top one here 6186 that's the first
window I launched which is this one, and I'm gonna type first right here. This
would be the second one which would be this one, so this is second window. And
then the third one we're gonna put over here. I'm going to do that so that
I can show you how you can identify processes based on chronological order,
if you know the order in which certain things were opened. I did because I only
ran three three instances of it, and the way that they opened told me which ones were on top,
and so I could see the order of them. Let's say I wanted to close second window. I can use
a command called "kill" So, I'll type "kill" and then "-9" and then the process ID.
So, in this case the second one which is 6300. So, if I type 6300 and hit enter it
kills that instance. So, if I run pgrep on liri browser again, it's
now just show me the other two. Now you can kill apps like this,
so 6186 and then another process ID 6358, and it's gonna kill all
those processes. Now that's pretty neat but let's say you've got a few instances
running, and you don't wanna type
the process IDs for each one. You can type "pgrep liri-browser"
this is gonna return 4 process IDs. Now in the "pgrep" command, the application
is pgrep, and then the second parameter that it takes is the command that's run.
So, it's the same when we run top, we'll see under command liri-browser right
here. So, we can see that's the command and if I was running from
terminal it would be /opt/liri/ or something like that, and the
resulting command would be liri-browser that's the actual binary file
that's running. So, what we can do rather than closing them by process ID, which
we can get like this, we can close them all at once by using the "killall" command.
And, so how to do that is basically type "killall" and then the process name, which is
"liri-browser" and that will kill all of those processes. So, that's basically how to manage and
monitor processes on a Linux machine, I hope I explained it well. In the next
video, we're gonna be discussing services.