Here's a preview from my zine, Bite Size Command Line! If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!
get the zine!
read the transcript!
ps
ps shows which processes are running
I usually run ps like this:
$ ps aux
u means include username column
a+x together show all processes
(ps -ef works too)
w
is for wide. ps auxwww will show all the command like args for each process
e
is for environment. ps auxe will show the environment vars!
wchan
you can choose which columns to show with ps (ps -eo...)
One cool column is ‘wchan’, which tells you the name of the kernel function if the process is sleeping.
try it:
$ ps -eo user,pid,wchan,cmd
process state
Here’s what the letters in ps’s STATE column mean:
R: runningS/D: asleepZ: zombiel: multithreaded+: in the foreground
f
is for “forest” :) ps auxf will show you an ASCII art process tree!
pstree can display a process tree, too.
ps has 3 different sets of command line arguments
(broken heart)
- UNIX (1 dash)
- BSD (no dash)
- GNU (2 dashes)
you can write monstrosities like:
$ ps f -f
f is “forest” (BSD)
-f is “full format” (UNIX)