/ factorpad.com / tech / linux-essentials / ps-command.html
An ad-free and cookie-free website.
Beginner
Learn to list and modify running jobs at the Linux command line.
Videos can also be accessed from the Linux Essentials Playlist on YouTube.
Linux ps Command Summary with Examples (3:36)
Our forty-fifth word, or command to memorize is
ps
from our category
System.
ps
allows you to print a snapshot of
current processes.
-options | description |
---|---|
--help |
Print help screen |
T |
Pring basic list on current terminal |
X |
Print extensive list beyond current terminal |
Recall that we just covered automating commands, and now we'll be able to monitor the system behind the scenes.
Before we start, it helps to think of commands as mini programs and
most follow this structure:
command -option(s) argument(s)
.
The ps
command has
over 40 options and there really aren't arguments per
se, just a whole slew of options, and I'll prevent us from getting into
minutiae here, and keep it very basic.
Like most commands, help is available with double-dash
--help
and it's multi-layered, making
it very, for lack of a better word, helpful.
The T
option shows processes in the
current terminal session, and X
goes
beyond that. These are capital letters on my version of
ps
and I should mention other
versions: Unix, BSD and GNU may differ.
So why is ps
an important command?
Well, not only for security is it important to monitor the system, but
you may need to intervene now and again.
And now you know how to do that.
Okay, the best way to embed this in your memory is by typing in your own terminal window.
Find this on your Mac using a program called Terminal. On Linux use Terminal or Konsole, and currently Microsoft is adding this functionality to Windows.
Here we go. Let's look at the multi-layered help system, typing
ps --help
.
Which provides other options, like
ps --help simple
.
As you can see here, and then last, let's type
ps T
.
And there are two processes running,
bash
and
ps
.
PID is the process ID number, TTY is
the terminal, STAT is the status,
here it's sleeping or running, but there are more, and
TIME is the time spent on the CPU.
Okay now you know how to use ps
.
And you know the syntax for commands, options and arguments.
One last tip about the ps
command.
So if you want a constantly updating version of
ps
,
try the top
command, especially if you
are a very curious person. Everyone should try it at least once in
their lives. Oh, letter q
is the safe
word that gets you out of the top
program.
Okay, thanks for visiting today. I hope this was a helpful
introduction to the ps
command.
For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:
Don't lose sight of this growing educational site which can improve your career materially. Three ways to stay connected, subscribe at YouTube, follow @factorpad on Twitter and join our no-spam email list.
crontab
command,
hit Back.printenv
command, click Next./ factorpad.com / tech / linux-essentials / ps-command.html
A newly-updated free resource. Connect and refer a friend today.