The Serpent

// Cursing the Internet since 1998

Processes on Linux

Posted Jan 1, 2019 Updated May 30, 2020 Cheatsheet

Understanding what’s running on Linux is a vital system administration job. This cheatsheet aims to provide quick reminders on how to query the Linux process structure.

The first command to introduce is ps, but the main ‘gotcha’ with ps is that there are various versions depending on your platform. 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 (including itself), 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 (-e) and show extra information, such as full path and arguments (-f):

ps -e

user@linux-host:~$ ps
  PID TTY          TIME CMD
11049 pts/0    00:00:00 bash
12658 pts/0    00:00:00 ps

ps -ef

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.

Processes on Linux
Posted January 1, 2019
Updated May 30, 2020
Written by John Payne