Site icon New Generation Enterprise Linux

Master `ps` Output with Custom `awk` Formatting

Quick Tip

Master `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: Combine `ps` with `awk` to precisely select and format the columns you need.

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

Why it works: `awk` is a powerful pattern scanning and processing language that can split lines into fields and print specific fields. Here, we’re printing the USER, PID, and COMMAND columns from the `ps aux` output.

Pro-Tip: For an even more tailored view, use `ps -eo user,pid,ppid,cmd,%mem,%cpu –sort=-%cpu | head -n 10` to see the top 10 CPU-consuming processes.

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

0 0 votes
Article Rating
Exit mobile version