What is the quickest way to see every process?
Run ps aux or ps -ef. Both print every process on the system, including kernel threads and daemons owned by other users. The two forms come from different Unix traditions: aux is BSD style and shows CPU and memory percentages, while -ef is System V style and shows the parent process ID, which helps when you want to know what launched something.
ps aux | less -S ps -ef --forest | less -S
less -S stops long command lines from wrapping, so each process stays on one row. Press the right arrow to scroll sideways and q to quit. --forest draws the parent and child tree in ASCII, which makes worker pools such as nginx or PHP-FPM easy to spot.
What do the columns in ps aux mean?
| Column | Meaning |
|---|---|
| USER | Account the process runs as |
| PID | Process ID, used by kill, renice and lsof |
| %CPU, %MEM | Share of one CPU thread over the process lifetime, share of physical RAM |
| VSZ, RSS | Virtual size and resident memory in KiB |
| STAT | State code such as R, S, D, Z plus flags |
| START, TIME | Start time and total CPU time used |
| COMMAND | The command line, kernel threads in square brackets |
RSS is the number that matters for memory pressure. VSZ includes mapped files and reserved address space that may never touch RAM, so a Java process with a huge VSZ is often harmless.
How do I sort processes by memory or CPU?
ps -eo pid,user,rss,pcpu,etime,comm --sort=-rss | head -15 ps -eo pid,ppid,pcpu,args --sort=-pcpu | head -n 12
The -o option picks exactly the columns you want and --sort=-field sorts descending. etime shows how long a process has been alive, handy for catching a cron job that never finished. For a live view that refreshes every few seconds, use The top command instead, since ps only shows one moment in time.
How do I find processes by name or by user?
pgrep -a php-fpm pgrep -u www-data -c ps -u postgres -o pid,stat,args ps -C redis-server -o pid,rss,args
pgrep -a prints the PID with the full command line, and -c just counts matches. ps -C matches the exact command name and avoids the classic mistake of ps aux | grep redis also matching the grep itself. If you still prefer grep, the bracket trick hides it: ps aux | grep '[r]edis'.
What do the process state letters mean?
- R: running or ready to run on a CPU.
- S: sleeping and waiting for an event, which is normal for idle daemons.
- D: uninterruptible sleep, nearly always waiting on disk or a network filesystem. Many D processes mean storage is the bottleneck.
- Z: zombie, finished but not yet collected by its parent. Zombies use no CPU or RAM; fix the parent if they pile up.
- T: stopped, for example after Ctrl+Z in a shell.
Extra flags follow the letter: s marks a session leader, l a multithreaded process, + a foreground job and < or N a raised or lowered priority.
How do I see which service started a process?
systemd-cgls --no-pager | less ps -o unit= -p 2817 pstree -p -a $(pgrep -o sshd)
On every image we install, systemd groups processes into control groups per service. systemd-cgls prints that tree, so a stray Python worker shows up under the unit that launched it. ps -o unit= gives the unit for one PID. pstree -p -a shows a branch with PIDs and arguments, for example every shell opened over SSH.
How do I list threads, not just processes?
ps -eLf | wc -l ps -T -p 4120 top -H -p 4120
-L adds one line per thread; counting them shows how close you are to the thread limit in /proc/sys/kernel/threads-max. A database or JVM with hundreds of threads is normal. On a machine with many cores, such as D3 with 112 threads, per-thread views show whether work is actually spread out or stuck on one thread.
What should I do with what I find?
Most process hunts end in one of three actions. A runaway job gets stopped with Kill a process. A service using more memory than expected gets limits in its systemd unit, for example MemoryMax=4G. A process that keeps reappearing gets traced to its unit or cron entry and fixed at the source. On a dedicated box nobody else shares the CPU, so the process list is the full story: if load is high, the cause is in that list.
Machines With Room for Busy Process Lists
| Server | Processor | Cores / threads | Memory | Storage | Network | Per month | Smallest order |
|---|---|---|---|---|---|---|---|
| E1 | Intel Xeon E3-1240 v3 | 4 / 8 | 16 GB DDR3 | 2x 240 GB SSD | 2x 1 Gbps | $30.52 | $91.56 (3 months) |
| S1 | Intel Xeon E-2276G | 6 / 12 | 64 GB DDR4 | 1x 1 TB NVMe | 2x 10 Gbps | $53.32 | $53.32 (1 month) |
| S6 | Intel Xeon E-2288G | 8 / 16 | 64 GB DDR4 | 2x 1 TB NVMe | 2x 10 Gbps | $89.92 | $89.92 (1 month) |
| D3 | 2x Intel Xeon Gold 6258R | 56 / 112 | 128 GB DDR4 | 2x 1 TB NVMe | 2x 25 Gbps | $275.32 | $275.32 (1 month) |
Keep Reading
The top command
Read every line of top, use the keys that matter, save a layout and run it in batch mode for logs and scripts.
OpenKill a process
Stop processes the right way: find them, send TERM before KILL, use systemctl for services, and handle zombies and stuck D-state tasks.
OpenCheck CPU usage and load
Read load averages against your thread count, split CPU time by type with mpstat and vmstat, find the busy process and keep history with sar.
Openlsof command
Use lsof to see which process holds a file, a port or a deleted log open, and free disk space without a reboot.
OpenFAQ
Quick Answers
Both list every process. ps aux adds CPU and memory percentages, while ps -ef shows the parent PID.
Those are kernel threads. They have no command line, so ps shows the thread name in brackets instead.
Run ps -e --no-headers | wc -l for processes, or ps -eLf --no-headers | wc -l to count threads.
Yes, ps shows every process by default. Some details such as open files or environment need root through sudo.
Its parent has not collected the exit status. Restarting or fixing the parent removes it, since a zombie itself cannot be killed.