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 overwhelming, showing too much information or not in the precise format you need for quick analysis. It’s often difficult to isolate specific process details like CPU usage, memory, or command name efficiently.

The Solution: Leverage `awk` to filter and format the output of `ps` for a cleaner, more focused view of your processes.

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

Why it works: This command uses `ps aux` to list all running processes and then pipes the output to `awk`. `awk` then prints only the User (column 1), PID (column 2), and Command (column 11), giving you a concise overview.

Pro-Tip: You can easily customize the columns you want to display by changing the numbers within the curly braces. For example, to see CPU usage and memory alongside the PID and command, you might use: `ps aux | awk ‘{print $1, $2, $4, $5, $11}’` (User, PID, %CPU, %MEM, Command).

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments