The top command is a powerful way to see what is using up your precious system memory. Here’s how to sort top output by memory usage.
Finding out which processes are using the most memory isn’t as simple on Linux as it is on Windows. Luckily, no matter what flavor of Linux you are using, the top command makes it easy to see how much memory each process is using.
The top command doesn’t order by memory usage by default, though, making it hard to see what is using the most RAM. If you’ve resurrected an old PC with a lightweight Linux distro, you’ll want to keep a close eye on what’s eating up all your RAM!
Here’s how to sort top processes by memory usage in Linux using the terminal top command.
Sorting the top Command Output by Memory Usage
To use the top command, open a terminal. On many systems, you can use the keyboard shortcut Ctrl + Alt + T to do this, or type terminal into the application search menu and open the command line from there.
To launch the top interface, type top at the terminal prompt and press Enter. This will open a display in the terminal showing a list of running processes, along with some general information about current tasks and processes running on your system.
By default, top doesn’t display processes in order of memory usage. It’s easy to re-order the menu by using the key combination Shift + M. This will refresh the list with the %MEM column showing memory usage in descending order.
Unsurprisingly, it was Chromium eating up all the RAM! Pressing Shift + M again will update the menu showing the current top RAM users. To quit top and return to the terminal, press Q.
Monitoring Memory Usage on Linux
The top command is a good one to master, as it works on almost all Linux systems, but if you are coming from Windows and are new to Linux, you might find Ubuntu System Monitor a bit more familiar.
Alternatively, if you are looking for an always visible widget displaying system information, there’s a whole load of awesome things you can do with Conky!
Ever looked at your Linux desktop and thought, “I could definitely make this better”? One great option is Conky, capable of displaying everything from new themes to pleasantly-styled CPU temperature data.
About The Author