Linux get ram size

Find Linux RAM Information Command

H ow do I find out ram information under Linux operating systems?

You can use the following commands to find information about RAM under Linux operating systems.

Find Used and Free RAM Info Command

You need to use the free command:
# free
# free -m

(Fig. 01: Display amount of free and used memory in the system)

  • No ads and tracking
  • In-depth guides for developers and sysadmins at Opensourceflare✨
  • Join my Patreon to support independent content creators and start reading latest guides:
    • How to set up Redis sentinel cluster on Ubuntu or Debian Linux
    • How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
    • How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
    • A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
    • How to protect Linux against rogue USB devices using USBGuard

Join Patreon

Find Out Ram Speed, Make, Form Factor, Type and Other Information

You need to use the dmidecode command:
# dmidecode —type 17
OR
# dmidecode —type memory
OR
# dmidecode -t 17
Sample outputs:

(Fig. 01: Finding RAM Speed, Manufacturer, Type such as DDR2, and other info)

🐧 Get the latest tutorials on Linux, Open Source & DevOps via

Category List of Unix and Linux commands
Documentation help • mandb • man • pinfo
Disk space analyzers df • duf • ncdu • pydf
File Management cat • cp • less • mkdir • more • tree
Firewall Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04
Linux Desktop Apps Skype • Spotify • VLC 3
Modern utilities bat • exa
Network Utilities NetHogs • dig • host • ip • nmap
OpenVPN CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04
Package Manager apk • apt
Processes Management bg • chroot • cron • disown • fg • glances • gtop • jobs • killall • kill • pidof • pstree • pwdx • time • vtop
Searching ag • grep • whereis • which
Shell builtins compgen • echo • printf
Text processing cut • rev
User Information groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w
WireGuard VPN Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04

Comments on this entry are closed.

free -m
dmidecode

probably just a typo, it should be:

# dmidecode –type 17

Thanks for very informative site,

Thanks for the heads up! The faq has been updated.

is also a good command if you like a graphical display of RAM

Good , i like htop.

less /proc/meminfo will give you detailed information on your systems memory. This is where all other utilities are pulling the information from.

If dmidecode pulls RAM info from /proc/meminfo then it’s using some super-dodecahedral secret decoder ring because “speed” and “type” aren’t there in “cat /proc/meminfo”.

عندي سؤال اذا ممكن حدا يجاوبني
how display information in ram?

Are you asking how to display the *contents* of RAM?

So now you need to install and lookup a command to find out such basic information as the memory type when Linux used to tell you in dmesg and the BSD’s still do.

I guess ‘modern’ Linux get’s more like windows every day. Will we be seeing vendor and product id codes in ALL cases rather than names next and hex error codes and unusable interfaces such as the registry requiring a second screen with a web browser to interpret becoming the norm.

such basic information as the memory type when Linux used to tell you in dmesg

That must have been a *long* time ago, since I’ve been using Linux since around Y2K (not for that reason though) and don’t remember dmesg ever having the level of detail that dmidecode has.

Источник

HowTo: Check RAM Size In Ubuntu Linux

Tutorial details
Difficulty level Easy
Root privileges No
Requirements None
Est. reading time 2m
  • free command
  • top command
  • vmstat command
  • /proc/meminfo file.

Display available memory on Ubuntu Linux

Open a command-line terminal (select Applications > Accessories > Terminal), and then type the following commands to view amount of free and used memory in the system including total ram:

You can also use the following command to get same info:

  • No ads and tracking
  • In-depth guides for developers and sysadmins at Opensourceflare✨
  • Join my Patreon to support independent content creators and start reading latest guides:
    • How to set up Redis sentinel cluster on Ubuntu or Debian Linux
    • How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
    • How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
    • A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
    • How to protect Linux against rogue USB devices using USBGuard

Join Patreon

The above output indicates that I’ve total 8GiB ram. You can get detailed info by typing the following cat command:
$ cat /proc/meminfo
Sample outputs:

Other commands

You can use other commands to get the same info:
$ vmstat
$ top
### you need to install htop ##
$ htop

This tutorial is also available in a quick video format:

GUI Tool To Find Out RAM Size Under Ubuntu Linux

The System Monitor application enables you to display basic system information and monitor system processes, usage of system resources, and file systems. You can also use System Monitor to modify the behavior of your system. To see memory information graphically, click on System > Administration > System monitor:

Fig.01: Ubuntu Linux Display Installed Memory

A note about 3GB ram problem

If your Linux based system only shows 3 GB ram (it may be in the 2.9–3.5 GB range) even if you got more than 3GB installed. You can get around this barrier running on x86 microprocessors by following this tutorial. The barrier can be resolved by moving to a 64-bit processor and operating system. On certain x86 hardware, it is possible to resolve it by using physical address extension (PAE) mode on x86.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via

Источник

Find Ram Size in Linux Using free And top Commands

Use /proc/meminfo file to find ram size in Linux

Tutorial details
Difficulty level Easy
Root privileges Yes
Requirements None
Est. reading time 5m

The /proc/meminfo file tells you about memory usage on the server. This file is used by the free command and many other Linux commands to display the amount of free and used memory (both physical and swap) on the system as well as the shared memory and buffers used by the kernel. Type the following cat command/less command to view total installed ram and used ram, enter:
$ less /proc/meminfo
OR
$ cat /proc/meminfo
Sample outputs:

Of course, we can use the grep command/egrep command as follows to filter out information:

Use free Command to check RAM size

Free command is a frontend to /proc/meminfo file. It provides more human-readable output to show you the total amount of free and used physical and swap memory in the system, as well as the buffers used by the kernel, run:
$ free -m
OR
$ free -g
Sample outputs:

The free command options

From the free(1) man page:

Hence, we try those options too:
$ free
$ free -m
$ free -g -t -o
$ free -t
$ free -o

Finding free and used ram info using the vmstat command

The vmstat command can display memory statistics including additional information about processes, paging, block IO, traps, and cpu activity. Pass the -s option to the vmstat to show us memory statistics as follows:
$ vmstat -s
Sample outputs:

The top Command

The top command provides a dynamic real-time view of a running system including a quick summary information about RAM, CPU as well as a list of tasks currently being managed by the Linux kernel. Type the following command:
$ top
Sample outputs:

Fig.01: Display Linux RAM Size with the top commad

GUI system information tool

The System Monitor Gnome or KDE application enables you to display basic system information and monitor system processes, usage of system resources, and file systems. You can start System Monitor in the following ways:
Click on System menu > Choose Administration > System Monitor
Alternatively, type the following command:
$ gnome-system-monitor
Sample outputs:

Linux view installed memory with the System Monitor application

  • No ads and tracking
  • In-depth guides for developers and sysadmins at Opensourceflare✨
  • Join my Patreon to support independent content creators and start reading latest guides:
    • How to set up Redis sentinel cluster on Ubuntu or Debian Linux
    • How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
    • How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
    • A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
    • How to protect Linux against rogue USB devices using USBGuard

Join Patreon

Say hello to dmidecode Command

The dmidecode command is used for dumping a computer’s DMI (some say SMBIOS) table contents in a human-readable format. This table contains a description of the system’s hardware components, as well as other useful pieces of information such as serial numbers and BIOS revision. Thanks to this table, you can retrieve this information without having to probe for the actual hardware. To see complete information about memory, enter:
$ sudo dmidecode —type memory
Sample outputs:

This tutorial is also available in a quick video format:

Conclusion

In this tutorial, you learned how to use the various command line and GUI tools amount of free and used memory in the Linux system. See free and vmstat command man page here and here:
man free
man vmstat
man top
man htop

🐧 Get the latest tutorials on Linux, Open Source & DevOps via

Источник

5 commands to check memory usage on Linux

Memory Usage

On linux, there are commands for almost everything, because the gui might not be always available. When working on servers only shell access is available and everything has to be done from these commands. So today we shall be checking the commands that can be used to check memory usage on a linux system. Memory include RAM and swap.

It is often important to check memory usage and memory used per process on servers so that resources do not fall short and users are able to access the server. For example a website. If you are running a webserver, then the server must have enough memory to serve the visitors to the site. If not, the site would become very slow or even go down when there is a traffic spike, simply because memory would fall short. Its just like what happens on your desktop PC.

1. free command

The free command is the most simple and easy to use command to check memory usage on linux. Here is a quick example

The m option displays all data in MBs. The total os 7976 MB is the total amount of RAM installed on the system, that is 8GB. The used column shows the amount of RAM that has been used by linux, in this case around 6.4 GB. The output is pretty self explanatory. The catch over here is the cached and buffers column. The second line tells that 4.6 GB is free. This is the free memory in first line added with the buffers and cached amount of memory.

Linux has the habit of caching lots of things for faster performance, so that memory can be freed and used if needed.
The last line is the swap memory, which in this case is lying entirely free.

2. /proc/meminfo

The next way to check memory usage is to read the /proc/meminfo file. Know that the /proc file system does not contain real files. They are rather virtual files that contain dynamic information about the kernel and the system.

Check the values of MemTotal, MemFree, Buffers, Cached, SwapTotal, SwapFree.
They indicate same values of memory usage as the free command.

3. vmstat

The vmstat command with the s option, lays out the memory usage statistics much like the proc command. Here is an example

The top few lines indicate total memory, free memory etc and so on.

4. top command

The top command is generally used to check memory and cpu usage per process. However it also reports total memory usage and can be used to monitor the total RAM usage. The header on output has the required information. Here is a sample output

Check the KiB Mem and KiB Swap lines on the header. They indicate total, used and free amounts of the memory. The buffer and cache information is present here too, like the free command.

5. htop

Similar to the top command, the htop command also shows memory usage along with various other details.

The header on top shows cpu usage along with RAM and swap usage with the corresponding figures.

RAM Information

To find out hardware information about the installed RAM, use the demidecode command. It reports lots of information about the installed RAM memory.

Provided information includes the size (2048MB), type (DDR2) , speed(667 Mhz) etc.

Summary

All the above mentioned commands work from the terminal and do not have a gui. When working on a desktop with a gui, it is much easier to use a GUI tool with graphical output. The most common tools are gnome-system-monitor on gnome and
ksysguard on KDE. Both provide resource usage information about cpu, ram, swap and network bandwidth in a graphical and easy to understand visual output.

A Tech Enthusiast, Blogger, Linux Fan and a Software Developer. Writes about Computer hardware, Linux and Open Source software and coding in Python, Php and Javascript. He can be reached at [email protected] .

66 thoughts on “ 5 commands to check memory usage on Linux ”

You have explained the topic very well. Thanks for sharing a nice article.

Thanks for these commands. It saved a lots of time.

How about explaining what we are looking for? Most people would know these commands. Waste of time.

Please correct the typo in “RAM Information” section. The command for viewing hardware info about RAM is “dmidecode” and not “demidecode”.
And it also requires root privileges.

Источник

Читайте также:  Установка базы mysql windows
Оцените статью