Site icon New Generation Enterprise Linux

Taming `ps` Output: Focused Process Info with `awk`

Quick Tip

Taming `ps` Output: Focused Process Info with `awk`

Challenge: The default output of the `ps` command can be overwhelming, showing more information than you need. It’s often difficult to quickly find specific process details like the exact command line or user.

The Solution: Use `awk` to filter and format the output of `ps` for precisely the information you want.

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

Why it works: The `ps aux` command lists all processes with user, memory, and command details. `awk` then processes this output line by line, printing only the specified fields: $1 (User), $2 (PID), and $11 (Command). You can easily change the field numbers to display different information.

Pro-Tip: To see the full command line, even if it’s truncated, use `ps auxww | awk ‘{print $1, $2, $11}’` (the `ww` flag expands the output).

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

0 0 votes
Article Rating
Exit mobile version