ITNuvoAkademiya
Academy homePackagesPlaylistsToolsSubnet calculatorSearchGlossary
CiscoCCNA · CCNA: networking fundamentals1. Introduction2. Network Fundamentals3. Network Access4. IP Connectivity5. IP Services6. IPv67. Security Fundamentals8. AutomationCCNP: Enterprise networks · coming soon
LinuxLinux: system administrator üçün · Linux for system administrators1. Getting to know Linux2. Working with text3. Users and permissions4. Processes and packages5. Inside the system6. Monitoring and logs7. NetworkingRed Hat Enterprise Linux · Red Hat Enterprise Linux: from beginner to advanced1. Getting started2. Packages3. Users and permissions4. SELinux5. Services6. Storage7. Networking8. Building services9. Boot and recovery10. DevOps11. Security and monitoring
FortinetFortiGate Administrator · FortiGate Administrator: from first login to ZTNA1. Getting to know FortiGate2. Routing, policy and NAT3. Security profiles4. Users and logs5. Resilience, SD-WAN and automation6. VDOM7. VPN and ZTNA8. Proxy9. DMZ
MonitoringZabbix · Zabbix: from installation to alerts1. Introduction2. Installation and the database3. Basics: groups, templates, users4. Connecting devices5. Alerts, Grafana and the API
VirtualizationProxmox VE · coming soonVMware ESXi · coming soon
My account / Sign in
AZENRU
← itnuvo.com

What a process is: ps, top, PID and PPID

Lesson 4.18 minBeginnerDecember 1, 2026
Open

This lesson is open to everyone. The other lessons open with a package: sign in or sign up, then choose a package.

Key points

  • Every process has a unique number, the PID, and the number of the process that started it, the PPID; the first process is systemd (PID 1).
  • ps aux shows all processes, ps -ef --forest the parent–child tree.
  • top (or htop) is the live view: P sorts by CPU, M by memory, q quits.
  • States: R running, S sleeping, D waiting for disk, Z zombie, T stopped.
  • pgrep -a nginx and pidof nginx find a process by name.

Program and process

A program is a file sitting on disk (/usr/sbin/nginx). When you start it, a process appears in memory: a live object with its own number, user, open files and memory. One program can have several processes — nginx works with one master process and several worker processes.

PID and PPID

srv-web01
ali@srv-web01:~$ echo $$
2741
ali@srv-web01:~$ ps -o pid,ppid,user,cmd -p $$
    PID    PPID USER     CMD
   2741    2740 ali      -bash

$$ is the PID of the current shell. Its parent (PPID 2740) is the SSH session. Every process is created by another process, and at the head of that chain stands systemd (PID 1).

srv-web01
ali@srv-web01:~$ ps -ef --forest | grep -E "sshd|bash|nginx" | grep -v grep
root      1032     1  0 08:55 ?        00:00:00 sshd: /usr/sbin/sshd -D [listener]
root      2702  1032  0 09:14 ?        00:00:00  \_ sshd: ali [priv]
ali       2740  2702  0 09:14 ?        00:00:00      \_ sshd: ali@pts/0
ali       2741  2740  0 09:14 pts/0    00:00:00          \_ -bash
root      1210     1  0 08:55 ?        00:00:00 nginx: master process /usr/sbin/nginx
www-data  1211  1210  0 08:55 ?        00:00:02  \_ nginx: worker process
www-data  1212  1210  0 08:55 ?        00:00:02  \_ nginx: worker process

Notice: the nginx master runs as root (to bind to port 80), while the workers run as www-data — the security principle from the previous unit.

ps aux: look at everything

srv-web01
ali@srv-web01:~$ ps aux --sort=-%mem | head -n 4
USER       PID %CPU %MEM    VSZ   RSS TTY  STAT START   TIME COMMAND
mysql     1340  1.2 18.4 1789420 372400 ?  Ssl  08:55   1:12 /usr/sbin/mysqld
root       842  0.1  2.3 289340  47212 ?   Ssl  08:55   0:04 /usr/lib/snapd/snapd
www-data  1211  0.3  0.6  56108  12880 ?   S    08:55   0:02 nginx: worker process
ColumnMeaning
%CPU, %MEMShare of processor and memory
VSZVirtual memory (KB) — reserved, not all of it used
RSSMemory actually held in RAM (KB) — look at this
STATState
TIMECPU time used so far

--sort=-%mem sorts by memory, descending; for CPU use --sort=-%cpu.

Process states

STATMeaning
RRunning or waiting in the queue
SSleeping, waiting for an event (the most common)
DWaiting for disk/network, cannot be interrupted
TStopped (Ctrl+Z)
ZZombie: finished, but the parent has not "collected" it

Extra letters: s session leader, l multi-threaded, + in the foreground, < high priority. Many processes in state D are a sign of a disk problem.

top: the live view

srv-web01
ali@srv-web01:~$ top
top - 10:31:07 up  1:36,  1 user,  load average: 0.42, 0.35, 0.30
Tasks: 128 total,   1 running, 127 sleeping,   0 stopped,   0 zombie
%Cpu(s):  3.1 us,  1.0 sy,  0.0 ni, 95.6 id,  0.3 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :   1967.4 total,    312.6 free,    842.1 used,    812.7 buff/cache
MiB Swap:   2048.0 total,   2048.0 free,      0.0 used.    956.3 avail Mem
KeyWhat it does
PSort by CPU
MSort by memory
kSend a signal to a process (next lesson)
1Show each core separately
qQuit

The two most important numbers in the header: wa (percentage waiting for disk — if high, the disk is the bottleneck) and avail Mem (memory really available for new processes). htop does the same with colours and mouse support: sudo apt install htop.

Finding a process by name

srv-web01
ali@srv-web01:~$ pgrep -a nginx
1210 nginx: master process /usr/sbin/nginx
1211 nginx: worker process
1212 nginx: worker process
ali@srv-web01:~$ pidof mysqld
1340
ali@srv-web01:~$ pgrep -u www-data -c
2

ps aux | grep nginx works too, but grep itself shows up in the result; pgrep is cleaner.

In the Linux simulator, see what is running on the server with ps aux, pgrep -a and top.

Check yourself

5 questions · answers are shown instantly · 3 correct answers complete the lesson

1Which process is PID 1 in Linux?

Every other process descends from systemd in a chain.

2What is the PPID?

Parent Process ID.

3Which column shows the RAM a process actually uses?

VSZ is reserved virtual memory, RSS is real RAM.

4Which key sorts top by memory?

P is CPU, M is memory.

5What does state Z mean?

A zombie has no resources left, only its row in the table remains.
Was this lesson useful?

Comments

Sign in to comment.