Quick Tip
Taming `ps` Output with `awk` for Focused Process Info
Challenge: The `ps` command often produces a lot of output, making it difficult to quickly find specific process information like CPU usage, memory, or process ID (PID) for a particular user or command.
The Solution: Use `awk` to filter and reformat the output of `ps` to display only the columns you need, or to filter based on specific criteria.
ps aux | awk '/your_process_name/ {print $1, $2, $3, $4, $11}'
Why it works: This command pipes the full output of `ps aux` to `awk`. `awk` then processes each line, and the `/your_process_name/` part filters for lines containing your desired process name. The `{print $1, $2, $3, $4, $11}` part then prints only the specified columns (e.g., User, PID, %CPU, %MEM, Command) from the matching lines.
Pro-Tip: You can also use `awk` to filter by user. For example, `ps aux | awk ‘$1 == “your_username” {print $2, $11}’` will show PIDs and commands for a specific user.
Linux Tips & Tricks | © ngelinux.com | 5/8/2026
