Site icon New Generation Enterprise Linux

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 verbose, making it difficult to quickly find specific information about running processes. You often need to sift through columns of data to locate process IDs (PIDs), CPU usage, or memory consumption.

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

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

Why it works: `ps aux` lists all running processes with detailed information. `awk` then processes this output line by line, using spaces as default delimiters, and prints specific fields (columns). In this example, it prints the USER, PID, %CPU, %MEM, and COMMAND.

Pro-Tip: Use `ps aux | awk ‘$3 > 5.0 {print $1, $2, $3, $11}’` to display processes using more than 5.0% CPU.

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

0 0 votes
Article Rating
Exit mobile version