Quick Tip
Streamline Process Monitoring with `ps` and `awk`
Challenge: The output of the `ps` command can be overwhelming, making it difficult to extract specific process information quickly. You often need to filter or reformat the output to find what you’re looking for.
The Solution: Combine `ps` with `awk` to precisely select and format the columns you need from the process list.
ps aux | awk '{print $2, $11, $12}'
Why it works: `ps aux` provides a comprehensive listing of running processes. `awk` then acts as a powerful text-processing tool, allowing us to select specific fields (columns) from each line of the `ps` output. In this example, we’re printing the Process ID (PID), command name, and its arguments.
Pro-Tip: You can easily change the columns you display by modifying the numbers within the `awk` ‘{print …}’ statement. For instance, `$1` is USER, `$4` is %CPU, and `$5` is %MEM.
Linux Tips & Tricks | © ngelinux.com | 5/19/2026
