Taming `ps` Output with Custom `awk` Formatting

Quick Tip

Taming `ps` Output with Custom `awk` Formatting

Challenge: The default output of the ps command can be verbose and difficult to parse, making it hard to quickly find specific process information like CPU usage, memory consumption, or command line arguments.

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

ps aux | awk '{print $1, $2, $3, $4, $11}'

Why it works: This command pipes the output of ps aux (which shows all processes with detailed information) to awk. awk then prints specific fields (columns) based on their positional number: user (1), PID (2), %CPU (3), %MEM (4), and the command (11). You can adjust the numbers to display any columns you desire.

Pro-Tip: To make this a more permanent shortcut, create a shell alias like alias psa='ps aux | awk '{print $1, $2, $3, $4, $11}' ' in your ~/.bashrc or ~/.zshrc file.

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments