Site icon New Generation Enterprise Linux

Tame Your `ps` Output: Focused Process Info with `awk`

Quick Tip

Tame Your `ps` Output: Focused Process Info with `awk`

Challenge: The output of the ps command can be overwhelmingly verbose, making it difficult to quickly find specific process information like CPU usage, memory, or command name.

The Solution: Use awk to filter and format the ps output to show only the columns you need.

ps aux | awk 'NR==1{print $0} $1=="your_user" {print $0}'

Why it works: This command pipes the output of ps aux to awk. NR==1{print $0} prints the header row, and $1=="your_user" {print $0} then prints all lines where the first field (the username) matches “your_user”. Replace “your_user” with the actual username you want to filter by.

Pro-Tip: To show only specific columns like PID, CPU%, and Command, you can use ps aux | awk '{print $2, $3, $11}' (adjust column numbers as needed for your system).

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

0 0 votes
Article Rating
Exit mobile version