0
0
Linux-cliHow-ToBeginner · 3 min read

How to Use ps aux Command in Linux: Syntax and Examples

Use the ps aux command in Linux to display all running processes with detailed information like user, CPU, and memory usage. The ps command shows process status, while aux options list all processes for all users in a user-friendly format.
📐

Syntax

The ps aux command combines three options:

  • a: Show processes for all users, not just the current user.
  • u: Display the process's user/owner and detailed info.
  • x: Include processes not attached to a terminal (background processes).

Together, ps aux lists all running processes with useful details.

bash
ps aux
💻

Example

This example runs ps aux to show all processes currently running on the system with columns like USER, PID, %CPU, %MEM, VSZ, RSS, TTY, STAT, START, TIME, and COMMAND.

bash
ps aux
Output
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.1 169084 5404 ? Ss 10:00 0:01 /sbin/init user 2345 0.1 0.5 256000 21000 pts/0 S+ 10:05 0:00 bash user 2350 0.0 0.3 150000 13000 pts/0 R+ 10:06 0:00 ps aux
⚠️

Common Pitfalls

Common mistakes when using ps aux include:

  • Running ps without options, which shows only processes for the current shell.
  • Confusing ps aux with ps -aux, where the dash changes behavior and may cause errors.
  • Not using grep to filter output when looking for specific processes, leading to overwhelming output.

Always use ps aux without a dash before aux for correct results.

bash
ps -aux  # Incorrect usage
ps aux   # Correct usage
Output
ps: invalid option -- '-' Try 'ps --help' for more information.
📊

Quick Reference

OptionMeaning
aShow processes for all users
uDisplay user-oriented format with detailed info
xInclude processes without controlling terminal

Key Takeaways

Use ps aux to list all running processes with detailed info on Linux.
Do not add a dash before aux; ps aux is correct, ps -aux is not.
Combine ps aux with grep to find specific processes easily.
The output columns include user, process ID, CPU and memory usage, and command details.
Remember a, u, and x options together show all processes comprehensively.