Site icon New Generation Enterprise Linux

Tame Your `ps` Output: Focused Process Info with `awk`

Quick Tip

Tame Your `ps` Output: Focused Process Info with `awk`

Challenge: The standard `ps` command often outputs a lot of information, making it difficult to quickly find specific details about running processes, such as CPU or memory usage for a particular application.

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

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

Why it works: `awk` allows you to specify which fields (columns) of the `ps` output you want to display. In this example, we’re showing the user, PID, %CPU, %MEM, and the command name.

Pro-Tip: Use `ps aux | grep ‘your_process_name’ | awk ‘{print $2}’` to quickly get just the PID of a specific process.

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

0 0 votes
Article Rating
Exit mobile version