Site icon New Generation Enterprise Linux

Taming `ps` Output with Custom `awk` Formatting

Quick Tip

Taming `ps` Output with Custom `awk` Formatting

Challenge: The default output of the `ps` command can be verbose and difficult to parse when you need specific process information quickly.

The Solution: Use `awk` to select and format specific columns from the `ps` output.

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

Why it works: This command pipes the output of `ps aux` to `awk`, which then prints only the User ID (column 1), Process ID (column 2), and the Command (column 11) for each process, making the output much cleaner and focused.

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

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

0 0 votes
Article Rating
Exit mobile version