On this pageTwo syntaxes, one tool
ps prints a snapshot of the process table: every program running on the machine, who owns it and what it costs. The output looks like noise until you know what each column measures, and two of them are routinely misread. This guide decodes the output, shows how to ask ps precise questions, and covers the safe ways to stop or slow down a process.
Two syntaxes, one tool
The ps on Linux (from the procps package) accepts two traditions. BSD style has no dash: ps aux means all processes with a terminal (a), plus those without one (x), in a user-oriented format (u). UNIX style uses dashes: ps -ef lists every process with its parent PID.
Do not write ps -aux. Under the UNIX rules it asks for processes owned by a user named x; procps guesses what you meant and may print a warning.
Read the ps aux columns
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.6 22536 13140 ? Ss Nov12 0:09 /sbin/init
www-data 2210 1.8 4.1 312764 84012 ? S 09:14 2:51 php-fpm: pool www
postgres 1184 0.3 6.9 219812 141220 ? Ss Nov12 14:02 /usr/lib/postgresql/17/bin/postgres
| Column | Meaning | Watch out for |
|---|---|---|
%CPU |
CPU time used divided by time alive | an average over the whole lifetime, not the current load |
%MEM |
resident memory as a share of RAM | shared pages count in every process that maps them |
VSZ |
virtual size in KiB | includes reserved but unused address space; rarely useful |
RSS |
resident memory in KiB | summing RSS overstates real usage |
TTY |
controlling terminal | ? means none, normal for services |
STAT |
state codes | see below |
START |
start time or date | |
TIME |
total CPU time consumed | a busy worker accumulates hours |
COMMAND |
command line | names in [brackets] are kernel threads |
The %CPU trap catches everyone: a process that burned CPU for an hour and then went idle still shows a high value, and a process that just woke up shows a low one. For what is busy now, use top, htop or pidstat 1 from the sysstat package.
The RSS trap matters on small servers. Twenty PHP-FPM workers sharing the same libraries each report the shared part again. For a fair per-process number, read the proportional set size, which splits shared pages among the processes using them:
grep -E '^(Rss|Pss):' /proc/2210/smaps_rollup
STAT codes
| Code | State |
|---|---|
R |
running or ready to run |
S |
sleeping, waiting for an event |
D |
uninterruptible sleep, almost always waiting on I/O |
I |
idle kernel thread |
T / t |
stopped by a signal / by a debugger |
Z |
zombie: finished, but the parent has not collected its exit status |
Modifiers follow the letter: s session leader, l multi-threaded, + in the foreground of its terminal, < raised priority, N lowered priority, L pages locked in memory.
Two states deserve attention. Several processes stuck in D point to a storage or network filesystem problem, and on Linux they also push the load average up even though they use no CPU. Zombies take no memory beyond a slot in the process table and cannot be killed, because they are already dead. Find the parent (ps -o ppid= -p <pid>) and fix or restart that.
Ask ps a precise question
ps aux --sort=-rss | head -n 6 # biggest memory users
ps -eo pid,ppid,user,%cpu,%mem,etime,cmd --sort=-%cpu | head
ps -C nginx -o pid,user,rss,cmd # one program by name
ps -u www-data -o pid,etime,cmd # one user's processes
ps -o pid,lstart,etimes,cmd -p 1184 # exact start time and age in seconds
ps -T -p 1184 # threads of one process
ps -ef --forest # parent and child tree
pgrep -a php-fpm # PIDs with full command lines
ps aux | grep nginx also matches the grep itself; pgrep and ps -C do not. pstree -p draws the tree more compactly, and pstree -s -p 2210 shows the ancestors of one process, which answers "what started this?" in one line.
Look inside one process
Once ps has pointed at a suspect, /proc/<pid> holds everything the kernel knows about it. A few files answer most questions:
grep -E '^(State|VmRSS|Threads)' /proc/2210/status # state, resident memory, thread count
tr '\0' ' ' < /proc/2210/cmdline; echo # the exact command line, arguments included
ls -l /proc/2210/exe /proc/2210/cwd # which binary runs, from which directory
cat /proc/2210/limits # open-file and process limits in force
sudo lsof -p 2210 | head -n 20 # files and sockets it holds open
The exe link is worth a glance when a process name looks odd: it points to the real binary on disk, and it reads (deleted) when the file was replaced or removed after the process started. That is normal right after a package upgrade, and a reason to restart the service so it runs the new code.
Stop a process the right way
kill sends a signal; the default is SIGTERM, a polite request to exit that lets the program flush data and remove lock files. SIGKILL (kill -9) cannot be caught or ignored: the kernel removes the process on the spot, with no cleanup. Use it only after SIGTERM failed.
kill 2210 # SIGTERM
kill -9 2210 # SIGKILL, last resort
pgrep -af 'python worker' # preview what a pattern matches
pkill -f 'python worker' # then signal all of them
Always preview a pkill -f pattern, because it matches anywhere in the full command line, including other users' processes when you run it as root.
Two more signals earn their place. kill -STOP <pid> freezes a process without ending it, and kill -CONT <pid> lets it carry on, which is handy for pausing a heavy batch job while you deal with something urgent. Many daemons treat SIGHUP as "reload your configuration", but check the program's documentation before relying on it.
If the process belongs to a systemd service, killing it is the wrong tool: with Restart= set, systemd starts it again a moment later. systemctl status 2210 names the unit that owns a PID, and systemctl stop or restart on that unit is the clean route.
Change priority with nice, renice and ionice
The nice value runs from -20 (most favored) to 19 (least), with 0 as the default. Anyone can make their own process nicer; only root can lower the value.
nice -n 10 tar -czf /root/site.tgz /var/www/site # start with lower CPU priority
renice -n 15 -p 2210 # change a running process
ionice -c 3 -p 2210 # idle I/O class: disk time only when nobody else wants it
ionice -c 2 -n 7 rsync -a /srv/data/ /mnt/backup/ # lowest best-effort I/O priority
ionice depends on the disk's I/O scheduler, shown in /sys/block/vda/queue/scheduler. Schedulers such as BFQ honor the classes, while none, common on NVMe and virtual disks, ignores them. For services, set Nice= and IOSchedulingClass= in the unit file so the setting survives restarts.
When a server keeps running out of memory no matter how you sort the list, the answer may be capacity rather than tuning. On CloudSat you can resize a server to a bigger plan and keep its disk and addresses.
FAQ
Why does ps show more than 100% CPU for one process?
ps adds up the CPU time of all threads. A multi-threaded program that keeps four cores busy can report close to 400%. top counts the same way until you press I to leave Irix mode, which divides the figure by the number of CPUs.
What are the processes in square brackets?
Kernel threads, such as [kworker/0:1] or [ksoftirqd/0]. They have no command line and no user-space memory. Treat a busy one as a symptom: heavy kworker activity usually traces back to storage or driver work.
Should I kill zombies or D-state processes?
You cannot kill either directly. A zombie disappears when its parent collects it or exits. A process in D waits for an I/O request to finish; fix the storage or network mount it is stuck on, and it continues or dies on its own.
Run it on CloudSat. Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. See plans or deploy a server.




