So let's talk about the PS command.
The PS command has two different dialects.
There's the BSD dialect and the system 5 dialect.
And the funny thing is that in the BSD dialect,
you have different options than what you
have in the system 5 dialect.
In BSD, options do not have a leading hyphen.
And in system 5, options do have a leading hyphen.
And because the options in the different dialects
are different, PS minus uppercase L and PS just uppercase
L are two completely different commands.
Now by itself, PS shows an overview of current processes.
And PSAUX is one of the most useful commands,
which will give you an overview of all currently running
processes.
Let me show you.
So PSAUX is giving an overview of all processes.
Pipe it through less so that you can see exactly what
is going on in the output.
So the first column is giving the name of the user
who owns the process.
Then we have the PID.
We have the percentage of CPU usage and of memory usage.
Then you have information about virtual memory and resident
memory, where resident memory really
counts because that is the amount of RAM
that the process is using.
If the process is running on a TTY,
you will see the TTY number and otherwise a question mark.
And otherwise a question mark that
indicates that the process is running in the background.
We have the status of the process, the start,
the amount of time that the process has been running,
and finally, the command that is related to the process.
As you can see, many of the commands
are between square brackets.
Anything that is between square brackets is a kernel thread.
Now, in the PSAUX output, you will also
notice that the processes that you have started last
are listed last in the list here.
Like the last command, that's what
we are currently looking at.
You might also like PS minus FAX,
which is showing the process forest.
So what do we see here?
Well, we see a relation between parent and child processes.
And this relation between parent and child processes
can be convenient to understand relations
and also to understand what is happening when you are sending
a signal to a certain parent process.
So it looks as if I'm currently in process 29493, which
is a child of 11501.
So if I kill 11501, my terminal will be killed
and I won't see anything anymore.
Now, the PS command has many options
that allow you to monitor processes that you want to see,
like PS minus F, U, Linda, for instance.
Oh, we don't see very much, so let's do it for student.
That's all processes that are currently
owned by user student.
Or what do you think of PS minus F minus minus forest minus
uppercase C SSHD, which is showing
SSHD including all of the child processes that it has started.
Now, this is an inactive SSHD, so we don't see very much.
PSL is showing the different format specifiers.
And you can use all of these format specifiers
to determine what exactly you want to do.
In commands like PS minus EOPID, PPID, user, CMD,
which is giving the process ID, the process
ID of the parent process, the user, as well as the command.
So as you can see, the PS command
is really a very flexible command.
But what really matters is PSAOX, pipe grab on anything.
And when you grab on anything, you
are probably interested in the PID,
because the PID is what is used all the time for managing
process.