GO KALI FREE
Process Commands

ps Linux Command

Reports a snapshot of current running processes with their PIDs.

What does ps do?

Reports a snapshot of current running processes with their PIDs.

Syntax

ps [options]

Practical example

ps aux

Questions about ps

What does ps aux show?

`-a` shows processes from all users, `-u` uses user-oriented format, and `-x` includes processes without a controlling terminal. It shows all running processes.

How do I see all running processes?

Use `ps aux` or `ps -ef` to see all processes. `ps aux` shows BSD format with CPU/memory usage, while `ps -ef` shows System V format.

How do I see processes by a specific user?

Use `ps -u username` or `ps aux | grep username` to filter processes by the user who owns them.

How do I see the process tree?

Use `ps auxf` or `ps -ef --forest` to display processes in a tree structure showing parent-child relationships.

How do I sort processes by CPU usage?

Use `ps aux --sort=-%cpu | head -10` to show the top 10 processes by CPU usage. Sort by memory with `--sort=-%mem`.

How do I find a specific process?

Use `ps aux | grep processname` or `pgrep processname` to find processes by name. `pgrep` returns just the PID.

What do the columns in ps aux mean?

USER=owner, PID=process ID, %CPU=CPU usage, %MEM=memory usage, VSZ=virtual memory, RSS=resident memory, STAT=state, COMMAND=name.

How do I see threads for a process?

Use `ps -Lf PID` or `ps -eLf` to show all threads (lightweight processes) for a specific process or all processes.

Related Process Commands

pgrep

Searches for processes by name and returns their PIDs.

top

Displays an interactive, real-time view of system processes and resource usage.

nohup

Runs a command that keeps running even after the terminal session is closed.

htop

Enhanced, more user-friendly version of top with color and mouse support.

renice

Changes the priority (niceness) of an already running process.

kill

Sends a signal to terminate a process by its PID.