×


Methods to check memory usage in CentOS 8 ?

Sometimes, when you are working on a Linux environment, you may need to install some new packages on a daily basis.

For this purpose, you need to check memory usage to install a new program. 

So, you should know how to check available and installed RAM or memory on your system.

Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform Linux related queries.

In this context, we shall look into the different commands to  check the memory usage in CentOS 8.


Different Commands to check memory usage in CentOS ?

You should have root account or sudo privileges to run the administrative commands. 

You can check the memory usage on your CentOS 8 Linux system by using the following five different commands which we will explain one by one in detail:

i. Cat command.

ii. Free command.

iii. Vmstat command.

iv. Top command.

v. Htop command.


1. How to use cat command to check Linux Memory ?

To use cat, Open the terminal and type cat /proc/meminfo on the terminal window. This will open the /proc/meminfo virtual file that displays the information about used and available memory.

The output will display the real-time information about the memory usage as well as the shared memory which is used by the kernel, buffers details.  


2. How to use free command to check Linux Memory ?

When you will execute the free command on the terminal, it will display the following information:

i. total represents the total memory installed on your system.

ii. used how much memory is currently using by running tasks ( you can calculate used memory = total – free – buffer/cache).

iii. free represents the memory that is not being used.

iv. shared shows the amount of memory that is being shared by different multiple processes.

v. Buffers amount of memory which is reserved by the OS kernel. This memory is further allocated as buffers when process will need.

vi. cached how much memory is used to store recently files in RAM.

vii. buff/cache Buffers + Cache memory.

viii. Available shows memory which is available for starting new tasks, without swapping.


You can use the following command you can explore a complete description and all options of free command:

$ man free


3.  How to use vmstat Command to check Linux Memory ?

The vmstat command is used to display complete statistics of virtual memory.

This command gives the information about the memory, system processes, CPU activity, paging, block IO, and traps.


4. How to use top command to check Linux Memory ?

Top command is a very useful command line tool that is used to examine the memory and CPU usage per process. 

It displays the information about the following things:

i. uptime.

ii. average load.

iii. tasks running.

iv. Information about the of users logged in.

v. number of CPU utilization.

vi. Swap and memory/ system processes.


Using the above top command, data is updated in a continuous manner, which allows you to monitor the memory for the processes in a real-time.


5. How to use htop command to check Linux Memory ?

The htop command provides similar information like the top command. However, one of the main advantages of the htop command is that it offers a user-friendly environment and improved control options.

For interactive interface, the htop command uses colors for displaying its output, gives a full command line environment for all processes, as well as it has the option to scroll the page both horizontally and vertically. 

Press Ctrl+c to exit from the current window.


You will see the following screen on your terminal:

i. The top section provides the information summary and contains graphic text counters.

ii. The middle section displays the detailed data of per process. It allows you to easily perform the separate actions on every individual process.

iii. All shortcuts are listed at the bottom of the displaying window that will enable you to customize and manipulate the processes quickly without using any command.


If this utility is not installed on your CentOS 8 system then, using the following command you can install it on your system:

$ sudo yum install htop 


How to check Linux Memory using GUI ?

If you want to check memory using the graphical user interface then, using the following method you can easily perform this action:

i. Type 'system monitor' in the application search bar. 

ii. Click on the above system monitor icon

iii. Select the ‘Resources’ tab where you can easily monitor the memory usage.


[Need urgent assistance to install missing Packages on your Linux Server? We are available to help you. ]


Conclusion

This article will guide you on how to check the #memory #usage on the #CentOS 8 system. Moreover, we have executed different commands such as cat, free, #vmstat, top and htop that are used to display the memory information. 

sudo apt-get clean clears out the local #repository of retrieved package files.It removes everything but the lock file from /var/cache/apt/archives/ and /var/cache/apt/archives/partial/. Another possibility to see what happens when we use the command sudo apt-get clean is to simulate the execution with the -s -option.

Using these commands, you can easily get information about your system RAM, and CPU.

Commands to check memory usage on Linux:

1. free command. The free command is the most simple and easy to use command to check memory usage on linux.

2. /proc/meminfo. The next way to check memory usage is to read the /proc/meminfo file. 3. vmstat. The vmstat command with the s option, lays out the memory usage statistics much like the proc command.

5. top command.

5. htop.