Find ram on linux

How to check RAM size?

-m , —mebi Display the amount of memory in mebibytes.

—mega Display the amount of memory in megabytes. Implies —si .

free -h will output it in human-readable output (usually GiB: Gibibytes—base 1024). But, since RAM is usually sold in GB (Gigabytes—base 1000), NOT GiB (Gibibytes), free -h —si is usually better, as @Jollywatt says, to output it in Gigabytes instead.

Open a terminal ( CTRL + ALT + T ).

Run following command to see RAM information in KB (1 KB is equal to 1024 bytes).

Run following command to see RAM information in MB (1 MB is equal to 1024 KB).

Run following command to see RAM information in GB (1 GB is equal to 1024 MB).

Or you can run following command to see more information about the same:

free -h seems most helpful to me. «all output fields automatically scaled to shortest three digit unit»

Click on the power/gear icon (System Menu) in the top right corner of the screen and choose About This Computer. You will see the total available memory in GiB. Multiply the value by 1024 to get the size in MiB.

This value (and the value shown as Total in output of free -m on the console), is total physical RAM size, minus the amount assigned to the internal GPU, if your computer has one.

To see the total amount of physical RAM installed, you can run sudo lshw -c memory which will show you each individual bank of RAM you have installed, as well as the total size for the System Memory. This will likely presented as GiB value, which you can again multiply by 1024 to get the MiB value.

Читайте также:  Посмотреть все группы пользователей linux

Источник

How can I find out the total physical memory (RAM) of my linux box suitable to be parsed by a shell script?

I’m typing a shell script to find out the total physical memory in some RHEL linux boxes. First of all I want to stress that I’m interested in the total physical memory recognized by kernel, not just the available memory. Therefore, please, avoid answers suggesting to read /proc/meminfo or to use the free, top or sar commands — In all these cases, their «total memory» values mean «available memory» ones. The first thought was to read the boot kernel messages:

Memory: 61861540k/63438844k available (2577k kernel code, 1042516k reserved, 1305k data, 212k init) 

But in some linux boxes, due to the use of EMC2’s PowerPath software and its flooding boot messages in the kernel startup, that useful boot kernel message is not available, not even in the /var/log/dmesg file. The second option was the dmidecode command (I’m warned against the possible mismatch of kernel recognized RAM and real RAM due to the limitations of some older kernels and architectures). The option —memory simplifies the script but I realized that older releases of that command has no —memory option. My last chance was the getconf command. It reports the memory page size, but not the total number of physical pages — the _PHYS_PAGES system variable seems to be the available physical pages, not the total physical pages.

# getconf -a | grep PAGES PAGESIZE 4096 _AVPHYS_PAGES 1049978 _PHYS_PAGES 15466409

My question: Is there another way to get the total amount of physical memory, suitable to be parsed by a shell script?

Источник

how to determine the available physical memory in linux

I’m trying to figure if my software running on linux suffers from memory leak . I’ve tried to measure the available physical memory as found in /proc/meminfo (see below) but could understand which field(s) represents the available memory and what is the relation between MemFree, Cached, Buffers, Active, Inactive .

cat /proc/meminfo MemTotal: 124128 kB MemFree: 62872 kB Buffers: 0 kB Cached: 15624 kB SwapCached: 0 kB Active: 38724 kB Inactive: 11148 kB SwapTotal: 0 kB SwapFree: 0 kB Dirty: 0 kB Writeback: 0 kB AnonPages: 34272 kB Mapped: 14640 kB Slab: 5564 kB SReclaimable: 424 kB SUnreclaim: 5140 kB PageTables: 504 kB NFS_Unstable: 0 kB Bounce: 0 kB WritebackTmp: 0 kB CommitLimit: 62064 kB Committed_AS: 57936 kB VmallocTotal: 655360 kB VmallocUsed: 1016 kB VmallocChunk: 654328 kB 

5 Answers 5

This is simpler command to check memory usage:

Читайте также:  Просмотр всех служб linux

/proc/meminfo is for overall system memory information. /proc/[pid]/status has the memory usage info for an individual process. (it’s also in /proc/[pid]/stat in a more machine parseable format).

In particular, VmData (size of data segment) and VmStk (size of stack segments) are most likely of use to you. Or just use ps or top instead of trying to read the data directly yourself.

The other numbers are likely to just be confusing, because the overall system memory usage is complicated by shared memory, various kinds of buffers, etc.

Источник

Find RAM size in Linux

When you order a dedicated server or cloud server with your web hosting provider, there is one thing you must check always when you first login into your system: your hardware must be exactly the same as ordered.

Lot of times, because of order mistakes, dedicated servers providers will give you less hardware resources than the ones you purchased. On this post, we will find out how to find RAM size in Linux / Unix operating systems with 5 useful commands.

How can I Find RAM size in Linux operating systems?

Here is the list of the top 5 commands that can be used to find LInux RAM size in Linux.

1. free command

The free command is the most classic terminal based tool to check memory usage on Linux / Unix operating systems.

[[email protected]:~]free total used free shared buff/cache available Mem: 32753636 9492448 1053688 603920 22207500 21961040 Swap: 8191996 1078724 7113272 [[email protected]:~]

The total OS RAM in bytes is 32753636, which can be translated to 32 GB of RAM installed on the system. The second colum called ‘used’ shows the the RAM used by the operating system, in this case around 9GB. Then you have the Free colum that is showing around 1GB, and the others called ‘shared’, ‘buffer/cache’ and ‘available’. It is normal to see lot of cached memory in the buff/cache on Linux operating systems, this memory can later be freed and used if really needed.
The last line belongs to the swap memory, which is reporting around 1GB of usage.

Читайте также:  Linux примеры файлов устройств

But this byte based numbers are not easy to read. Let’s use two useful parameters that can be added to the free command:

Now we add -ht to the free command. -h is used to transform bytes into human readable units, and -t is used to display a line showing the column totals.

[[email protected]:~]free -ht total used free shared buff/cache available Mem: 31G 9.1G 1.0G 589M 21G 20G Swap: 7.8G 1.0G 6.8G Total: 39G 10G 7.8G [[email protected]:~]

As you see on this output, now the free command is showing the information in sizes humans can read.

2. top command

Top command is one of my favourite and most used tools to quickly check out system performance, but it can also be used to get valuable hardware information.

Источник

Оцените статью
Adblock
detector