Site icon New Generation Enterprise Linux

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, especially on busy systems. Extracting specific process information can be tedious and error-prone.

The Solution: Combine `ps` with `awk` to filter and display only the columns you need.

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

Why it works: `ps aux` lists all running processes with user, PID, CPU/memory usage, and command. `awk ‘{print $1, $2, $4, $11}’` then prints only the first (user), second (PID), fourth (CPU%), and eleventh (command) fields, providing a concise and relevant overview.

Pro-Tip: Use `ps -eo pid,ppid,cmd,%cpu,%mem –sort=-%cpu | head` to see the top 10 CPU-consuming processes with their PIDs, parent PIDs, and command names.

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

0 0 votes
Article Rating
Exit mobile version