View Running Processes
The ps command displays information about currently running processes on a Linux system, showing details like process ID (PID), CPU usage, memory consumption, and what command started each process.
Think of ps like opening Task Manager on Windows - it shows you what's running right now on your system. IT administrators use it to monitor system performance, find resource-hungry applications, identify which user is running what, troubleshoot hung processes, find process IDs for killing misbehaving programs, and investigate security issues by seeing unexpected processes. It's one of the first commands you run when something's going wrong on a Linux server.
Advertisement
[ Insert Google AdSense Banner Code Here ]
Check which processes are using the most CPU and memory.
Get PIDs for processes you need to kill or manage.
Identify hung processes or applications using too many resources.
Look for suspicious or unexpected processes running on the system.
ps Show your processes (just current terminal).
ps aux Show ALL processes with full details (most commonly used).
ps -ef Show all processes in full format (alternative to ps aux).
ps aux | grep nginx Find processes related to nginx (search for specific process).
ps -u root Show all processes owned by root user.
ps -p 1024 Show details for specific process ID (PID 1024).
ps aux --sort=-%mem Show processes sorted by memory usage (highest first).
ps aux --sort=-%cpu Show processes sorted by CPU usage (highest first).
ps -eo pid,ppid,cmd Custom format showing only PID, parent PID, and command.
ps vs top: ps shows a snapshot, while top shows live updating data. Use ps for quick checks, top for monitoring.
Combine with grep: Almost always use ps aux | grep processname to find specific processes quickly.
Process states: R=Running, S=Sleeping, D=Uninterruptible sleep, Z=Zombie (needs cleanup), T=Stopped. The + means it's in the foreground.
Practice ps commands in the interactive terminal below: