Sometimes you need to quickly figure out which process is running under a specific PID. In this guide, we’ll show you how to do that — but first, let’s briefly go over how processes work in Linux. Whenever you or the system launches a program, the Linux kernel creates a separate process for it. This process holds all the information about the program’s execution: variables, input/output, state, and more.
Since Linux is a multitasking system, it runs many processes at once. To keep things organized, each process is assigned a unique number — the PID (Process ID). Without it, managing tasks would be a mess.
Information about processes is stored in the /proc directory. Each running process has its own folder named after its PID.
You can simply use the ls command to look inside /proc:
ls /proc
If the list is too long, it helps to pipe it through less:
ls /proc | less
The numbered folders represent running processes. The names of those folders are their PIDs.
For example, the systemd process, which launches the system, always has PID 1. To see what’s inside its folder:
ls /proc/1
To check which processes are running and what their PIDs are, use standard tools:
→ ps aux — lists all processes along with their PIDs.
→ top — opens an interactive view of active processes, updating in real time.
→ glances — a modern monitoring tool that shows CPU, memory, disk usage, and more in a user-friendly way.
If you know the name of a program, you can find its PID with pidof:
pidof firefox
pidof python
pidof cinnamon
Now for the main part — say you already have a PID and want to know what process it refers to. Use this command:
ps -p PID -o comm=
Examples:
ps -p 2523 -o comm=
ps -p 2295 -o comm=
Here:
→ -p specifies the PID.
→ -o comm= tells ps to output only the command name (i.e., the process name).
To explore more options with ps, check its manual:
man ps