Site icon New Generation Enterprise Linux

Taming `ps` Output: Focused Process Info with `awk`

Quick Tip

Taming `ps` Output: Focused Process Info with `awk`

Challenge: The output of the `ps` command can be overwhelming, especially on busy systems. You often need to sift through a lot of information to find specific processes or sort by particular metrics.

The Solution: Leverage `awk` to filter and format the `ps` command’s output for targeted information.

ps aux | awk '$1 == "your_user" {print $1, $2, $11}'

Why it works: This command uses `ps aux` to list all running processes with user information. The `awk` command then filters this output, printing only lines where the first field (`$1`, the username) matches “your_user”. It then prints the username, PID (`$2`), and command name (`$11`) for those matching processes.

Pro-Tip: To sort processes by memory usage (descending), you can use `ps aux –sort=-%mem | head -n 10`.

Linux Tips & Tricks | © ngelinux.com | 5/21/2026

0 0 votes
Article Rating
Exit mobile version