Site icon New Generation Enterprise Linux

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

Quick Tip

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

Challenge: The output of the `ps` command can be overwhelmingly verbose. It’s often difficult to quickly isolate the specific information you need about processes, such as CPU usage, memory consumption, or command line arguments.

The Solution: Pipe the output of `ps` to `awk` to filter and display only the desired columns.

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

Why it works: `awk` allows you to specify which fields (columns) you want to print from the input. In this example, we’re printing the USER (field 1), PID (field 2), and the command itself (field 11) from the `ps aux` output, creating a much cleaner and more focused view.

Pro-Tip: For a more dynamic view of processes, you can combine this with `watch`: watch -n 1 'ps aux | awk '{print $1, $2, $11}'

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

0 0 votes
Article Rating
Exit mobile version