Processes on Linux | Cheat Sheet
A very brief guide to managing processes on Debian based Linux systems.
Having only shell access to a Linux box requires some pretty nifty CLI skills. One common command that comes up often is
ps, which reports the current
state of processes.
The main ‘gotcha’ with
ps is that there are various versions depending on your platform. But they can be broken down into two categories:
- BSD style commands (no dashes required before options)
- UNIX style commands (dashes required before options)
Because we’re focusing on Linux (and therefore UNIX), we’re going to be using dashes with our options. On its own,
ps outputs the processes associated with the
current user and terminal. Hence why you might only get a small list when running it, because a terminal generally isn’t running anything other then Bash. To
get more detailed options, we’ll need to go deeper:
Display all running processes. TTY is the associated terminal (if any) and TIME is the culminated CPU time (percentage) the process has used:
For more information, such as full path, use -f or -F (even more detail):
To limit to a particular user:
ps -f -u root
The additional output option gives a lot more columns of interest. Key ones include ‘PPID’, which lists the parent PID of a process.