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

The Solution: Combine `ps` with `awk` to precisely filter and format the output, focusing only on the columns you need.

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

Why it works: `ps aux` provides a comprehensive list of processes. `awk` then processes this output line by line, printing only the fields corresponding to the user (column 1), PID (column 2), %CPU (column 3, but we skip this in this example to match the output fields provided), %MEM (column 4), and the command name (column 11). Adjust the column numbers to tailor the output to your specific needs.

Pro-Tip: To make this command reusable, create a shell alias or function: alias psf='ps aux | awk '\''{print $1, $2, $4, $11}'\'''

Linux Tips & Tricks | © ngelinux.com | 6/4/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments