Site icon New Generation Enterprise Linux

Streamline `ps` Output with Custom `awk` Formatting

Quick Tip

Streamline `ps` Output with Custom `awk` Formatting

Challenge: The output of the `ps` command can be verbose and overwhelming, making it difficult to quickly find the specific process information you need.

The Solution: Use `awk` to filter and reformat the output of `ps` to display only the columns you’re interested in.

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

Why it works: This command pipes the output of `ps aux` (which shows all processes) to `awk`. `awk` then processes each line, printing only the specified columns: User (1), PID (2), CPU usage (3), and Command (11).

Pro-Tip: You can easily add or change the column numbers in the `awk` command to customize the output further. For example, to also see memory usage, use: ps aux | awk '{print $1, $2, $3, $4, $11}'

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

0 0 votes
Article Rating
Exit mobile version