Tame Your Processes: Focused `ps` Output with `awk`

Quick Tip

Tame Your Processes: Focused `ps` Output with `awk`

Challenge: The output of the `ps` command can be overwhelming, making it difficult to quickly find specific information about running processes, such as CPU usage, memory consumption, or command line arguments.

The Solution: Combine `ps` with `awk` to filter and format the output for precisely the information you need.

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

Why it works: `ps aux` lists all processes in a detailed format. `awk` then processes this output line by line, printing only specific columns: the user ($1), PID ($2), CPU percentage ($3), memory percentage ($4), and the command name ($11). This provides a concise view of essential process details.

Pro-Tip: To see the full command line, including arguments, use ps aux | awk '{$1=$2=$3=$4=$5=$6=$7=$8=$9=$10=""; print $0}' | sed 's/^ *//'. This clears the initial columns and prints the rest of the line, then removes leading whitespace.

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