To quickly list all running processes in the command line, you can use platform-specific commands that reveal every active application, service, or system task. On Linux/macOS, `ps aux` shows all processes in plain detail, while Windows users rely on `tasklist` in Command Prompt. Both methods reveal CPU/memory usage without extra tools, and modern shells even highlight long-running or resource-heavy tasks. If you need deeper insights—like filtering by service or checking for stuck processes—plug these commands into a terminal and customize with pipes or flags. No admin rights are required unless you’re inspecting system services.
What You'll Need
- Your operating system’s terminal or command prompt (Command Prompt/PowerShell on Windows, Terminal on macOS/Linux).
- Basic familiarity with keyboard shortcuts (e.g., tab for autocomplete, arrow keys to navigate).
- Optional: A text editor or file to save output (e.g., `Ctrl+S` in Terminal to redirect output).
Step-by-Step
-
On Linux/macOS:
Open Terminal and run:
ps auxWhat it does: Lists all processes with columns for user, CPU usage, memory, start time, and command. Filter output with:ps aux | grep "search_term"(e.g.,ps aux | grep nginx). Shortcut: PressCtrl+Cto cancel if the output scrolls too fast. -
On Windows:
Open Command Prompt (search for "cmd" in Start) and run:
tasklistWhat it does: Displays all running processes with names, PIDs, and CPU/memory stats. To filter (e.g., only UI apps):tasklist | findstr "explorer.exe". For PowerShell: Use:Get-Processto list processes with name, ID, CPU, and RAM. -
Cross-platform filtering:
Redirect output to a file for export:
ps aux > processes.txt(Linux/macOS) ortasklist > processes.txt(Windows). Verify: Check the file’s contents with a text editor. -
Advanced: Show only CPU/memory-heavy tasks:
- Linux/macOS:
top -o cpu(interactive) orps aux --sort=-%cpu | head -n 10(top 10 CPU users). - Windows:
tasklist /FI "IMMENABLED=TRUE"(list only enabled processes).
- Linux/macOS:
Common Mistakes
-
Ignoring hidden processes: Commands like
ps auxshow all processes, including systemd/systemd-journald. For Linux, usepgrep -ato list *all* processes by name, even hidden ones. -
Windows-only confusion: On Windows,
tasklistexcludes some background services (e.g., Windows Defender). Usewmic process listfor broader coverage. -
Output truncation: If output scrolls away, press
Ctrl+Shift+S(Linux/macOS) orCtrl+Shift+F(Windows) to save manually. AvoidCtrl+Cunless you’re sure the process isn’t blocking output.
Tips
-
Real-time updates: For dynamic monitoring, use:
- Linux/macOS:
watch -n 1 ps aux(refreshes every 1 second). - Windows:
tasklist /svc(shows services alongside processes).
- Linux/macOS:
-
Kill a process: After identifying a PID (Process ID), kill it with:
- Linux/macOS:
kill -9(force kill). - Windows:
taskkill /PID(forceful close).
- Linux/macOS:
-
Compare OSes: A process like
zsh(macOS) andcmd.exe(Windows) serve vastly different roles. Use tooling likepsf(Linux) to cross-check between shells. -
Performance impact: Running
ps auxrepeatedly can spike CPU usage. Limit checks to critical tasks (e.g.,ps aux | grep "chrome").
Troubleshooting
-
No output?
- Check if the terminal is open and not minimized. Restart Terminal if needed.
- On Windows, ensure Command Prompt is running as Administrator—some services require elevated access.
- Try
psortasklist /FI "PID=XX"(replace XX with a known PID) to test connectivity.
-
Processes not showing?
- Some services (e.g., Docker, VMs) run as non-interactive users. Use:
- Linux:
pgrep -x "service_name"to find exact names. - Windows:
wmic process get name,processid.
- Linux:
- Check system logs for hidden services:
- Linux:
journalctl(systemd logs). - Windows: Enable
Event Viewer > Windows Logs > System.
- Linux:
- Some services (e.g., Docker, VMs) run as non-interactive users. Use:
-
Shell errors?
- Linux/macOS: If you see
command not found, ensure Terminal is updated with:sudo apt upgrade(Debian/Ubuntu) orbrew update(macOS). - Windows: Run as Administrator and check for typos in commands (e.g.,
tasklist, nottasklst**>).
- Linux/macOS: If you see
Frequently Asked Questions
What if I need to see processes from another user?
- Linux/macOS: Use
sudo ps auxto run as root (requires admin privileges). - Windows: Open Command Prompt as Admin and run
tasklist /FI "USERNAME=user_name"orGet-Process -User user_name(PowerShell).
Why do some processes show as "unknown" or "not responding"?
- Common culprits:
- Third-party firewalls blocking process discovery.
- Corrupted processes (e.g., malformed scripts).
- System services misbehaving (e.g.,
swapspaceon Linux).
- Suggested fixes:
- Restart the system. Restarting services like
systemd(Linux) orservices.msc(Windows) often resolves this. - Check for updates:
sudo apt upgrade(Linux) orSettings > Windows Update(Windows).
- Restart the system. Restarting services like
Can I sort by memory usage instead of CPU?
- Yes. On Linux/macOS:
- Use
ps aux --sort=-%mem | head -n 10(top 10 memory consumers). - For PowerShell (Windows):
Get-Process | Sort-Object WMem | Select-Object -First 10.
- Use
How do I stop a process that isn’t responding?
- First, identify the PID from
tasklist/ps aux. Then:- Linux/macOS: Use
kill -9(force kill). - Windows: Use
taskkill /PID(forceful termination)./F
- Linux/macOS: Use
- If it persists, check for orphaned processes or system issues (e.g., swap space exhaustion).
Why does "ps aux" show 1,000+ processes on Linux, but Windows shows fewer?
- Windows hides some background services (e.g.,
smss.exe,svchost.exe). Linux shows nearly everything, including systemd-managed processes. - For a balanced view, use:
- Linux:
systemctl list-units --type=service(services) +ps aux(rest). - Windows:
wmic service list brief(services) +tasklist(rest).
- Linux:
How can I save this list to a file for later review?
- Linux/macOS:
- Run
ps aux > processes_$(date +%Y-%m-%d).txtto save with a timestamp. - Use
grep "search_term" processes.txtto filter later.
- Run
- Windows:
- Run
tasklist > processes_$(date /t).txt(PowerShell) ortasklist > processes_%%DATE%%_%%TIME%%_%%YEAR%%_%%MONTH%%_%%DAY%%.txt(cmd).
- Run
Bonus: Command Cheat Sheet
| Command | Platform | Purpose |
|---|---|---|
ps aux |
Linux/macOS | List all processes with full details. |
tasklist |
Windows | List all processes with CPU/RAM stats. |
pgrep -a "app_name" |
Linux/macOS | Find all PIDs for a specific app (hidden processes). |
top -o cpu |
Linux/macOS | Interactive view of CPU usage. |
Get-Process |
Windows (PowerShell) | List processes with name, ID, and memory. |
These commands are your first line of defense for debugging resource leaks, identifying stuck processes, or verifying service statuses. Adjust filters as needed—your terminal is the Swiss Army knife for system inspection.