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 output of the ps command can be overwhelming, often displaying more information than you need. Filtering and extracting specific details can be tedious.

The Solution: Combine ps with awk to precisely select and format the information you want to see.

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

Why it works: ps aux lists all running processes in a user-friendly format. awk then processes this output line by line, printing only the specified columns (User, PID, and Command in this example). You can easily change the column numbers to extract different information.

Pro-Tip: To see only processes owned by the current user, use ps -f | awk -v user="$USER" '$1 == user {print $2, $8}'.

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

0 0 votes
Article Rating
Exit mobile version