Linux Display Memory: Processes Consuming Most Memory in Linux and How to Manage them with Commands

Linux Display Memory: Processes Consuming Most Memory in Linux and How to Manage them with Commands
Page content

Introduction to Memory Management

The memory on a computer is one of the most demanded resources from any application. All applications need memory to run, some more than others. Even though memory is dirt cheap these days, it always helps to clean the list of running processes and check if any applications are utilizing more memory than required. You can then quit/restart these applications to free up wasted memory.

The commands used in this article will be most useful when you have system-wide privileges. This can be in the form of a root password or relevant privileges with the sudo command.


The “top” command is one of the most important utilities available for any user in Linux. It is just like the Task Manager in Windows and displays a list of the running tasks and various details about each application. The output is automatically updated often. The output of top contains the following fields:


While some of the fields are not important for us, the column you should be paying attention to is %MEM. This column displays the percentage of total memory that the application is using. For example, if the Xorg command is shown with 10% of memory on a computer running 2GB of total memory (physical + swap memory), then it is using around 200MB of memory.


The “vmstat” command shows summary information about memory, processes, interrupts, paging and block I/O information. We’re only interested in the information about memory. Typing the command as “vmstat -S M” will show the memory sizes in MB form, which is easier to read and understand. The Free column shows how much free memory we have. The “buff” column shows the amount of buffered memory, and “cache” shows the amount of cached information in the memory.

Since this command gives a barebones-style output, using commands like top is recommended for a better understanding of the memory usage on your Linux computer.


The “free” command shows a nicely summarized table containing information about the memory on your computer. Different columns are given to show information about Total memory, Used memory and Free memory. Typing the command as “free -m -t” shows you the information in MB units and a row at the bottom giving the Total amount of memory of each column.


Check out the picture to understand the output of the free command.


The “ps” command is the most useful command for any system administrator or user. It displays a list of running processes on the computer. The output is quite similar to the top command, but with the ability to pick and choose what type of information is included in the output. Typing the command as “ps aux” shows a list of all the running processes for all users on the system. The information given by the ps command is similar to the information given by the top command and therefore, if you can understand the output of one, you can easily understand the output of the other command.


Check out the picture of the ps command in action.

Final Words

With these awesome tools in hand, you should easily be able to locate rogue applications which are using a lot of memory on your system. Once you have the PID of the processes, you can simply close them using their respective interfaces or through the command line by typing the command “kill ”, where is replaced by the PID of the application in question.