Linux Process Management: From ps to Process Trees
Master Linux process management—viewing, controlling, and troubleshooting processes with ps, top, kill, and more.
February 25, 2026 · 9 min · 1733 words · Rob Washington
Table of Contents
Understanding processes is fundamental to Linux troubleshooting. These tools and techniques will help you find what’s running, what’s stuck, and what needs to die.
# All processes (BSD style)ps aux
# All processes (Unix style)ps -ef
# Process treeps auxf
# Specific columnsps -eo pid,ppid,user,%cpu,%mem,stat,cmd
# Find specific processps aux | grep nginx
# By exact name (no grep needed)ps -C nginx
# By userps -u www-data
# Run in background./script.sh &# List background jobsjobs# Bring to foregroundfg %1
# Send to backgroundbg %1
# Suspend current processCtrl+Z
# Disown (detach from terminal)disown %1
# Run immune to hangupsnohup ./script.sh &# Or use screen/tmux for persistent sessions
# Top memory consumersps aux --sort=-%mem | head -10
# Detailed memory infops -eo pid,ppid,cmd,%mem,rss --sort=-rss | head -10
# Memory by process nameps -C nginx -o pid,rss,cmd
# System memory overviewfree -h
# All open files by processlsof -p 1234# Files in directorylsof +D /var/log
# Network connections by processlsof -i -p 1234# Who's using a portlsof -i :80
# Who's using a filelsof /var/log/syslog
# Files by userlsof -u www-data
# View limitsulimit -a
# Max open filesulimit -n
# Set for sessionulimit -n 65535# Permanent (in /etc/security/limits.conf)www-data soft nofile 65535www-data hard nofile 65535
# Find process using port 8080 and kill itkill$(lsof -t -i:8080)# Kill all processes matching patternpkill -f "python.*myapp"# Kill with confirmationpgrep -l myapp && pkill myapp
# Wait for specific PIDwhilekill -0 1234 2>/dev/null;do sleep 1;doneecho"Process finished"# Wait for process by namewhile pgrep -x nginx > /dev/null;do sleep 1;doneecho"nginx stopped"
# Viewps aux # All processestop / htop # Real-timepstree -p # Tree with PIDspgrep -l name # Find by name# Controlkill PID # Graceful stopkill -9 PID # Force killpkill name # Kill by namekillall name # Kill all matching# Infolsof -p PID # Open filesstrace -p PID # System callscat /proc/PID/status # Process status# Resourcesnice -n 10 cmd # Run with low priorityrenice 10 -p PID # Change priorityulimit -a # View limits
Process management is detective work. Start with the overview (ps, top), drill down to specifics (lsof, /proc), and trace execution when needed (strace).
The goal isn’t to memorize every flag—it’s to know which tool answers which question. “What’s using all my CPU?” → top. “What files does this process have open?” → lsof. “Why is this process hanging?” → strace.
📬 Get the Newsletter
Weekly insights on DevOps, automation, and CLI mastery. No spam, unsubscribe anytime.