Site icon New Generation Enterprise Linux

Tame Your `ps` Output with `awk` for Focused Process Info

Quick Tip

Tame Your `ps` Output with `awk` for Focused Process Info

Challenge: The `ps` command often produces verbose output, making it difficult to quickly find specific process information like the user running a process, its PID, or its CPU/memory usage.

The Solution: Pipe the output of `ps` to `awk` to filter and format the data precisely.

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

Why it works: `ps aux` lists all processes with user, PID, CPU usage, memory usage, and command. `awk` then selectively prints specific columns (User, PID, %CPU, %MEM, Command) based on their positional index.

Pro-Tip: Use `ps -eo pid,ppid,cmd,%cpu,%mem –sort=-%cpu | head` to see the top CPU-consuming processes.

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

0 0 votes
Article Rating
Exit mobile version