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 overwhelming, displaying a vast amount of information about running processes. Often, you only need specific details like the process ID (PID), CPU usage, and memory usage.

The Solution: Leverage the power of awk to filter and format the output of ps, presenting only the columns you need.

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

Why it works: ps aux provides a detailed listing of all processes. awk '{print $1, $2, $3, $4}' then processes this output line by line, printing only the first four fields (USER, PID, %CPU, %MEM) which are commonly useful.

Pro-Tip: To also include the command name, use ps aux | awk '{print $1, $2, $3, $4, $11}' where $11 is typically the command name for most systems. Adjust field numbers as needed.

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments