How to check available memory in Ubuntu

Linux, BSD and * nix operating systems in general, provide users with many options to view information within the system. Just open a terminal and type cat / proc / cpuinfo, cat / proc / meminfo or cat / proc / net / wireless.

Linux, BSD and * nix operating systems in general, provide users with many options to view information within the system. Just open the terminal and type cat / proc / cpuinfo, cat / proc / meminfo or cat / proc / net / wireless . Although the data found through these Linux commands is quite comprehensive, they are not easy to read at all. Let's see some utilities that display memory usage in a more readable format in the following article!

Note: Although the instructions here are for Ubuntu, you can read it for most other Linux distributions.

How to check memory on Ubuntu?

  1. Graphic utilities to check RAM usage
    1. Gnome System Monitor
    2. Conky
  2. Check the free memory with the command line utilities
    1. 'Free' utility
    2. 'Top' and 'htop' utilities

Graphic utilities to check RAM usage

By default, Ubuntu includes an application called System Monitor. Users can access this tool by clicking the Show Applications button at the bottom left and then entering from the monitor to search for the application.

If it is not installed on the distribution you are using, you can install it with:

 sudo apt install gnome-system-monitor 

Gnome System Monitor

Picture 1 of How to check available memory in Ubuntu

This application has 3 tabs to view information about processes, resources and file system. Tab Process is very useful. Not only to see memory usage, users can also right-click programs and change their CPU usage priority, forcing programs to close, etc.

In the Resources tab , users can view information about CPU load, memory usage and Swap (virtual RAM), as well as network activities.

Picture 2 of How to check available memory in Ubuntu

Sometimes users may want to monitor memory usage when opening or using programs. Right-click the bar (title) at the top of the memory usage window and select Always on Top . This will keep the window displayed all the time, even if you open a full screen program. You can use the same trick with htop or other utilities in the terminal window.

Conky

Another popular solution for tracking system resources is Conky. It is an integral part of the desktop. It is always active and allows users to quickly see information about system resources at any time. Please install it with the following command:

 sudo apt install conky-all 

By default, it displays on the left side of the screen and will be superimposed on the application bar. Therefore, move it to the right:

 cp /etc/conky/conky.conf ~/.conkyrc && sed -i 's/left/right/' ~/.conkyrc sed -i 's / left / right /' ~ / .conkyrc 

Open a terminal and enter:

 conky 

Picture 3 of How to check available memory in Ubuntu

Of course, the default settings are very basic, so they often don't look very nice. But this utility is very flexible and can display many other system indicators. Moreover, some themes created by other users make Conky very beautiful. You can apply if you want. For more on how to customize Conky, please refer to the article: How to use Conky to make Linux more awesome.

Check the free memory with the command line utilities

Sometimes the graphical user interface is not available, for example on servers. In such cases, there are command line utilities that can display information about memory usage.

'Free' utility

Open a terminal and enter the following command:

 free -h 

Picture 4 of How to check available memory in Ubuntu

Display results can be confusing for new users who have moved from Windows to. Here, 'free' does not mean the amount of free memory that applications can use. That's because 'buff / cache' . When the operating system reads a file from a hard drive or SSD, it will hold the data of that file in RAM. In this way, when you need to read the file again, the operating system can skip accessing the storage device and read directly from RAM. This will be much faster. That's why if you open the browser, close it, then open it again, the browser will load much faster.

Although the buffer and cache can use almost all RAM, users can still consider the available memory. That's because as soon as an application needs more RAM, some data buffer / cache will be immediately deleted to free up memory for the required program.

Therefore, the most important fields here are 'used' and 'available'. 'Used' reflects the amount of RAM that the program is using and 'Available' indicates how much RAM is available for the required application. This is really the amount of RAM left. Concepts 'free,' 'used' and 'available' are also used in some graphics applications.

'Top' and 'htop' utilities

Another command, usually available on Linux systems, is 'top'. You can type 'top' in the terminal to open it. Press q to exit. But, as you can see in the illustration below, it's a bit hard to read.

Picture 5 of How to check available memory in Ubuntu

This is why so many users prefer a more friendly version, called htop. First, install this utility:

 sudo apt install htop 

Then start the program.

 htop 

Picture 6 of How to check available memory in Ubuntu

As you can see, htop is much easier to read, thanks to the use of colors and column charts. The first and the front columns are numbers 1, 2, etc., reflecting the use of CPU core. In the Memory column, you can pay attention to the green lines. The remaining two lines are blue and brown, reflecting the buffer and cache of the file as well as the directory. As mentioned in the previous section, they can be deleted from memory at any time to free up parts of RAM that can be used.

Besides using keys to interact with htop, you can also use the mouse cursor to click on the displayed elements.

These are the most common applications for displaying Ubuntu memory usage. You can sort processes according to the amount of RAM they use. You may find that you do not need some applications that take up a lot of memory and have the right to remove them from your system.

See more:

  1. How to manage memory to restrict Linux to use too much RAM
  2. Learn about swapping Linux memory space
  3. How to use Memory Cleaner to release RAM
Update 26 May 2019
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile