Hey, folks, in this video, we are going to cover the PS Command.
The PS Command stands for process Status and it displays all the currently running processes in your
Linux system.
So an example would be by just running the PS Command, which will show you the processes of the current
shell.
So if you logged in to your Linux machine and your shell environment is bash, for example, then it
will show you the process status of that shell.
So when you run the PS command, the output will be in four different columns.
One would be paired p process id, t time and cmd, and what e stands for.
You have that in front of you.
But let's go into our Linux machine and run the command and run the command.
So we are right here.
Who are we logged in as we run?
Who am I myself, which directory we are in and which host are you logged in?
So we have confirmed Beautiful.
We know that we are not logged into the wrong machine, so that's great.
Let's clear the screen now.
Just simply run the PS command and for the PS command you don't need to be root.
So when you hit enter you'll see you get the four columns.
First one is process ID.
This is a unique process ID of the process that you're running.
And in this example, when you run command, the bash is your process.
That is the environment that you have to log in.
The second column is the t y, which is telling you the terminal type that the user logged in to.
So the terminal right here, it's actually the console login that we have logged in right here in our
terminal.
Then we have time.
This is the amount of time sorry amount of CPU and minutes and seconds that the process has been running.
And by the way, if you see right here 0000, it means the CPU hasn't done anything to process anything
or any requests from this shell.
That's where you see 0000 and zero zero.
Then the last column is the command.
It is the name of the command.
So if you're running PS command, let's say to get the status of your terminal, you'll see that it
is also getting the PS status of its own command because Linux is so fast that it will go and check
all the processes running by that user.
And it kept or it got you the PS command itself.
All right.
So let's move on to the other examples of the command is PS minus E, which shows all the running processes
that you have in the Linux system.
So let's clear the screen and run PS minus E and you will see all these different processes, this process
ID and T, the terminal, the time and the command.
So all these processes are running in this environment.
Then you have a PS, a UX, which shows all the running processes in BSD format.
Now BSD is a Berkeley systems description.
It is something that was used initially when the UNIX was became the operating system.
So anyway, not to worry about it and let's not go too much detail into BSD, let's run PS a UX and
you will see a lot more columns Now instead of just those four columns.
It also tells you the user, the user name, the process ID, the CPU usage, the memory usage, the
start times, stop time and commands a lot of information, a lot of system administrator run this command
as well.
Then the next command.
That's one of my favorite command.
Every time I need to know or check the status of any process or all the process in my Linux environment.
I run PS dash F, which F is shows all the running process and full format listing.
So if I run PS minus F and hit enter, you'll see it will give you all the information that you're looking
for.
And as I said, this is one of my favorite commands and I have seen a lot of system administrators.
Engineers are used to using this command and these options give you the user ID, PID, parent ID command
right here and the time the tie session, the session time itself.
Moving on to PS minus a you username, this command will show you all the processes by the user name.
So let's say if you wanted to see all the processes just by root, you will run PS minus you and your
type of root and it'll give you all the processes that are being managed or running by.
If I wanted to do the same thing for myself, I'll do PS minus you.
I have XLB and I'll give you all the processes that are running by my user.
All right, so let's clear the screen and now let's do a quick comparison of this command in our Windows
environment.
So if I wanted to see all the processes running in our Windows environment, we'll pretty much go to
a task manager, right click and click here, task manager.
And right here you'll see all these processes.
These are all the applications running.
If you wanted to see all the services, all the processes that are running, just like PS Command or
PS minus F command, then you will see all these are the processes that are listed, the process ID
with the description with status and the group name.
So that's how you could get the comparison.
And another thing is previously we learned the system CTL command, right?
So if I do system CTL Status Firewall dx.
You will see that it's giving me the status which is active.
The process ID you could get some of the information from the PS command as well.
So if I do PS minus F and GREP for that process ID, which is what.
750.
Right.
So let's type 750.
Oops.
All right, 750.
Enter.
And right here it is, grabbing that process.
See?
Firewall.
DX This is the process.
You can also do the same thing by running PS minus F and grep for firewall D and it will give you the
same information as the PED, so you could get the information of a specific process by running system
CTL.
And if you do not know the unit name or the process name.
Then you could run PS Command and you could specify like, let's say just fire.
If you don't remember the complete name, then you could just specify a fire and it will give you all
the matching services that are running in your Linux environment.
I'll see you in the next lecture.