How to Sort Processes by Virtual Memory in Ubuntu
Managing system resources on Ubuntu requires identifying which applications consume the most space. This article provides a quick overview of how to sort active processes by their virtual memory usage using built-in terminal tools. You will learn specific commands to monitor memory consumption and identify heavy processes immediately.
Using the top Command
The top utility provides a dynamic real-time view of
running processes. To sort by virtual memory:
- Open your terminal.
- Type
topand press Enter. - Once the interface loads, press
Shift+Von your keyboard. - The list will reorder to show processes with the highest VIRT values at the top.
Using the ps Command
For a static snapshot sorted by virtual memory, use the
ps command. Run the following command in your terminal:
ps aux --sort=-vsz
This lists all processes sorted by virtual set size (vsz) in
descending order. The - symbol ensures the largest
consumers appear first. You can also limit the output to specific
columns for clarity:
ps -eo pid,comm,vsize --sort=-vsize