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 `ps` command can be overwhelmingly verbose, providing more information than you often need. Extracting specific details about running processes can be cumbersome.

The Solution: Leverage `awk` to filter and format the output of `ps`, allowing you to display only the most relevant process information.

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

Why it works: The `ps aux` command lists all processes with detailed information. `awk ‘{print $1, $2, $11}’` then processes this output line by line, printing only the first ($1 – USER), second ($2 – PID), and eleventh ($11 – COMMAND) fields, giving you a concise overview of who is running what.

Pro-Tip: To filter for a specific process, for example, all processes related to ‘nginx’, you can pipe the output to grep: ps aux | grep nginx | awk '{print $1, $2, $11}'

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

0 0 votes
Article Rating
Exit mobile version