Raspberry Pi

4 Ways to Check the Size of RAM in Raspberry Pi

The latest model of Raspberry Pi has four different RAM variants 1GB, 2GB, 4GB, and 8 GB. The excessive load on RAM can affect the performance of the Raspberry Pi system and it’s always recommended for Raspberry Pi users to check for RAM size before making any further operation on the system, such as installing an application that requires more RAM or executing some heavy tasks simultaneously.

This article discusses different ways to check the size of RAM in Raspberry Pi.

4 Ways to Check the Size of RAM in Raspberry Pi

There are four useful commands to check the RAM size in Raspberry Pi, which are listed below:

  • proc/meminfo
  • vmstat command
  • free command
  • top command

The usage of each of these commands is discussed below in detail. To use any of the listed commands, open the terminal first and then go for any of the below commands you like.

1: proc/meminfo

The “proc/meminfo” file includes the system memory information and to retrieve this information, you must apply the “cat” command with the file name including the “MemTotal” command to get the total system memory.

$ cat /proc/meminfo |grep MemTotal

2: vmstat command

Another command that can be used to check the detail memory status of Raspberry Pi device is the “virtual memory stats” command, which is given below:

$ vmstat -s

The output displays the size of total memory along with the partitions in the form of swap memory. By default, the output displayed is in kilobytes:

3: free command

There is another simplest and most used command to check the RAM size on Raspberry Pi, which is the “free” command. You can write this command with multiple flags, including b, k,m, or g as these flags display the RAM size in bytes, kb, megabytes, and gigabytes, respectively. The output presented by each command includes the total, used, free, shared, buff/cache, and available RAM memory including the swap memory too.

To get the size of RAM in bytes, use the following command:

$ free -b

To get the size of RAM in kilobytes, use the following command:

$ free -k

To get the size of RAM in megabytes, use the following command:

$ free -m

To get the size of RAM in gigabytes, use the following command:

$ free -g

4: top command

The last command on our list is the top command, which is also used to check the system information such as CPU, RAM, and swap size:

$ top

The command displays the size of memory used by each command along with the number of users, load average, and other such details:

That’s all the four ways to check RAM size in Raspberry Pi now let’s conclude!

Conclusion

To check the size of the RAM of Raspberry Pi, four simple commands can be used: top command, free command, proc/meminfo command, and vmstat. All these commands along with their purpose are discussed in the above guidelines. The users can opt for any of these ways if they want to check the RAM size of their Raspberry Pi for any reason.

About the author

Zahra Zamir

An Electronics graduate who loves to learn and share the knowledge, my passion for my field has helped me grasp complex electronics concepts and now I am here to share them with others.