{"id":32988,"date":"2020-03-14T19:00:31","date_gmt":"2020-03-14T13:30:31","guid":{"rendered":"https:\/\/www.wikitechy.com\/technology\/?p=32988"},"modified":"2020-03-16T11:35:04","modified_gmt":"2020-03-16T06:05:04","slug":"how-to-check-memory-usage-from-the-linux-terminal","status":"publish","type":"post","link":"https:\/\/www.wikitechy.com\/technology\/how-to-check-memory-usage-from-the-linux-terminal\/","title":{"rendered":"How to Check Memory Usage From the Linux Terminal"},"content":{"rendered":"<p>There are plenty of ways you can get the lowdown on memory usage within your Linux system. In this roundup, we\u2019ll cover the most commonly used command-line methods: free, vmstat, and top. We\u2019ll also look at reading \/proc\/meminfo directly.<\/p>\n<h2 id=\"how-linux-uses-ram\"><strong>How Linux Uses RAM<\/strong><\/h2>\n<p>RAM is a finite resource that all processes, like applications and daemons, want a piece of. There\u2019s only so much of it available. The kernel referees the memory squabbles and allocates the rationed memory out to all the hungry processes. It\u2019s kind of like a mother bird with more open beaks pointed at her than she has the grub for.<\/p>\n<p>Unused RAM is wasted RAM. Linux uses any spare RAM for things like file buffer space, to keep your computer running at optimum performance. It\u2019s easy to get the impression that your system\u2019s RAM has been consumed by some runaway process or memory leak, but that\u2019s rarely the case.<\/p>\n<p>It\u2019s usually just the kernel tenaciously doing its job in the background. If there are other demands for the RAM that the kernel has poached for its own devices, it relinquishes the memory instantly, so there\u2019s no harm done.<\/p>\n<p>If the kernel decides it\u2019s more efficient to start using swap space, it brings that into play, as well. There\u2019s a lot of confusion about the swappiness value in Linux and when the kernel will start using swap. It\u2019s untrue that the swappiness value sets a threshold for RAM usage that triggers swap to be enabled.<\/p>\n<p>But now, let\u2019s look at the different techniques you can use in the terminal window to see the RAM usage on your Linux computer.<\/p>\n<h4 id=\"the-free-command\">The free Command<\/h4>\n<p>The free command gives you a table of the total, used, free, shared, buffer\/cache, and available RAM on your computer. It also shows you the total amount of swap space configured.<\/p>\n<p>In our example, we\u2019ll use the -m (mebibytes) option. However, you could also use -b (bytes), -k (kibibytes), or -g (gibibytes).<\/p>\n<p>We type the following command:<\/p>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <\/div> <pre class=\"language-sql code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-sql code-embed-code\">free -m<\/code><\/pre> <\/div>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter size-full wp-image-32992\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2020\/03\/x1-11.png.pagespeed.gpjpjwpjwsjsrjrprwricpmd.ic_.iwEydS9tJM.png\" alt=\"\" width=\"646\" height=\"167\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2020\/03\/x1-11.png.pagespeed.gpjpjwpjwsjsrjrprwricpmd.ic_.iwEydS9tJM.png 646w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2020\/03\/x1-11.png.pagespeed.gpjpjwpjwsjsrjrprwricpmd.ic_.iwEydS9tJM-300x78.png 300w\" sizes=\"(max-width: 646px) 100vw, 646px\" \/><\/p>\n<p>This is the output we get:<\/p>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <\/div> <pre class=\"language-sql code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-sql code-embed-code\">      total used free shared buff\/cache available<br\/>Mem:   1987  901   95     80        990       811<br\/>Swap: 1521   651  869<\/code><\/pre> <\/div>\n<p>The\u00a0Mem\u00a0columns contain the following information:<\/p>\n<ul>\n<li><strong>Total<\/strong>: The total amount of physical RAM on this computer.<\/li>\n<li><strong>Used<\/strong>: The sum of Free+Buffers+Cache subtracted from the total amount.<\/li>\n<li><strong>Free<\/strong>: The amount of unused memory.<\/li>\n<li><strong>Shared<\/strong>: Amount of memory used by the\u00a0tmpfs\u00a0file systems.<\/li>\n<li><strong>Buff\/cache<\/strong>: Amount of memory used for buffers and cache. This can be released quickly by the kernel if required.<\/li>\n<li><strong>Available<\/strong>: This is an estimate of the memory that\u2019s available to service memory requests from applications and any other operational software on your computer.<\/li>\n<\/ul>\n<p>The\u00a0Swap\u00a0columns contain the following information:<\/p>\n<ul>\n<li><strong>Total<\/strong>: The size of the swap partition or file.<\/li>\n<li><strong>Used<\/strong>: The amount of swap space that\u2019s in use.<\/li>\n<li><strong>Free<\/strong>: The amount of remaining (unused) swap space.<\/li>\n<\/ul>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <\/div> <pre class=\"language-sql code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-sql code-embed-code\">free -m | grep Swap | awk &#039;{print ($3\/$2)*100}&#039;\t<\/code><\/pre> <\/div>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-32996\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2020\/03\/2-9.png\" alt=\"\" width=\"646\" height=\"97\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2020\/03\/2-9.png 646w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2020\/03\/2-9-300x45.png 300w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2020\/03\/2-9-640x97.png 640w\" sizes=\"(max-width: 646px) 100vw, 646px\" \/><\/p>\n<p>It\u2019s impossible to have a good understanding of the way RAM is used in your Linux box without an appreciation of the state of your swap space. RAM and swap space work closely together.<\/p>\n<p>You can use the\u00a0vmstat\u00a0command\u00a0to take a deeper dive into how your swap space (or virtual memory) is being used. It gives you a report on a variety of\u00a0\u00a0based on the average values since the last reboot.<\/p>\n<p>Type the following:<\/p>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <\/div> <pre class=\"language-sql code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-sql code-embed-code\">vmstat<\/code><\/pre> <\/div>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-32997\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2020\/03\/x3-13.png.pagespeed.gpjpjwpjwsjsrjrprwricpmd.ic_.PdNcb0XWqJ.png\" alt=\"\" width=\"646\" height=\"197\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2020\/03\/x3-13.png.pagespeed.gpjpjwpjwsjsrjrprwricpmd.ic_.PdNcb0XWqJ.png 646w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2020\/03\/x3-13.png.pagespeed.gpjpjwpjwsjsrjrprwricpmd.ic_.PdNcb0XWqJ-300x91.png 300w\" sizes=\"(max-width: 646px) 100vw, 646px\" \/><\/p>\n<p>This is the output without the wrap-around:<\/p>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <\/div> <pre class=\"language-sql code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-sql code-embed-code\">procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----<br\/>r b    swpd    free  buff   cache   si  so    bi   bo    in   cs  us sy id wa st<br\/>3 0  671488  576084  51088  823876   1   7    53   62    99   14   4  1 95  0  0<\/code><\/pre> <\/div>\n<p>There are a lot of data points in that report, so we\u2019ll break them down:<\/p>\n<ul>\n<li><strong>Proc:<\/strong><\/li>\n<\/ul>\n<p><strong>r<\/strong>: The number of \u201crunnable\u201d processes. They\u2019re either running or waiting for their next time-sliced burst of CPU cycles.<\/p>\n<p><strong>b<\/strong>: The number of processes in uninterruptible sleep. These aren\u2019t sleeping, but performing a blocking system call. They can\u2019t be interrupted until they complete their current action. Typically, this process is a device driver waiting for some resource to be free. Any queued interrupts for that process are handled when the process resumes its usual activity.<\/p>\n<ul>\n<li><strong>Memory:<\/strong>\n<ul>\n<li><strong>swpd<\/strong>: The amount of virtual memory used, i.e., how much memory has been swapped out.<\/li>\n<li><strong>free<\/strong>: The amount of idle (unused) memory.<\/li>\n<li><strong>buff<\/strong>: The amount of memory used as buffers.<\/li>\n<li><strong>cache<\/strong>: The amount of memory used as cache.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Swap<\/strong><strong>\u00a0 \u00a0 \u00a0 \u00a0<\/strong><\/li>\n<li><strong> si<\/strong>: The amount of virtual memory swapped in from swap space.<\/li>\n<li><strong>so<\/strong>: The amount of virtual memory swapped out to swap space.<\/li>\n<li><strong>IO:<\/strong><\/li>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><strong>bi<\/strong>: Blocks in. The number of data blocks used to swap virtual memory back to RAM.<\/li>\n<li><strong>bo<\/strong>: Blocks out. The number of data blocks used to swap virtual memory out of RAM and into swap space.<\/li>\n<\/ul>\n<\/li>\n<li><strong>System:<\/strong>\n<ul>\n<li><strong>in<\/strong>: The number of interrupts per second, including the clock.<\/li>\n<li><strong>cs<\/strong>: The number of context switches per second. A context switch is when the kernel swaps from system to user mode processing.<\/li>\n<\/ul>\n<\/li>\n<li><strong>CPU:\u00a0<\/strong>These values are all percentages of the total CPU time:\n<ul>\n<li><strong>us<\/strong>: Time spent running user (non-kernel) code.<\/li>\n<li><strong>sy<\/strong>: Time spent running kernel code.<\/li>\n<li><strong>id<\/strong>: Time spent idle.<\/li>\n<li><strong>wa<\/strong>: Time spent waiting for in- or output.<\/li>\n<li><strong>st<\/strong>: The time a virtual machine has to wait for the hypervisor to finish servicing other virtual machines before it can come back and attend to this virtual machine.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><strong>The top Command<\/strong><\/p>\n<p>The\u00a0top\u00a0command\u00a0displays a screen packed with information.\u00a0The values are updated every few seconds.<\/p>\n<p>To use it, we type the following:<\/p>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <\/div> <pre class=\"language-sql code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-sql code-embed-code\">top<\/code><\/pre> <\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-33001\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2020\/03\/x5-7.png.pagespeed.gpjpjwpjwsjsrjrprwricpmd.ic_.jHWr3jM1OR.png\" alt=\"\" width=\"646\" height=\"382\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2020\/03\/x5-7.png.pagespeed.gpjpjwpjwsjsrjrprwricpmd.ic_.jHWr3jM1OR.png 646w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2020\/03\/x5-7.png.pagespeed.gpjpjwpjwsjsrjrprwricpmd.ic_.jHWr3jM1OR-300x177.png 300w\" sizes=\"(max-width: 646px) 100vw, 646px\" \/><\/p>\n<p>The \u201ce\u201d key was pressed. This changed the display to megabytes, which are easier to visually parse than long strings representing bytes.\u00a0There are five lines of information at the top of the screen and a lower pane with columns of data.<\/p>\n<ul>\n<li><strong>Line one:<\/strong>The time, how long the computer has been running, how many people are logged in, and what the load average has been over the past one, five, and 15 minutes.<\/li>\n<li><strong>Line two:<\/strong>The number of tasks and their states: running, stopped, sleeping, or zombie.<\/li>\n<li><strong>Line three:<\/strong>CPU information (see the breakdown of the fields below).<\/li>\n<li><strong>Line four:\u00a0<\/strong>The total amount of physical memory, and how much is free, used, buffered, or cached.<\/li>\n<li><strong>Line five:<\/strong>Total amount of swap memory, and how much is free, used and available (taking into account memory that\u2019s expected to be recoverable from caches).<\/li>\n<\/ul>\n<p>The CPU fields on line three are as follows:<\/p>\n<ul>\n<li><strong>us:<\/strong>Time the CPU spends executing processes for users in user space.<\/li>\n<li><strong>sy:<\/strong>Time the CPU spent running system \u201ckernel space\u201d processes.<\/li>\n<li><strong>ni:<\/strong>Time the CPU spent executing processes with a manually set nice value.<\/li>\n<li><strong>id:<\/strong>CPU idle time.<\/li>\n<li><strong>wa:<\/strong>Time the CPU spends waiting for I\/O to complete.<\/li>\n<li><strong>hi:<\/strong>Time the CPU spent servicing hardware interrupts.<\/li>\n<li><strong>si:<\/strong>Time the CPU spent servicing software interrupts.<\/li>\n<li><strong>st (steal time):<\/strong>Time the CPU lost due to running virtual machines.<\/li>\n<\/ul>\n<p>You might have to press the left or right arrow keys to see all the columns. The values in each column are described below:<\/p>\n<ul>\n<li><strong>PID:<\/strong>Process ID.<\/li>\n<li><strong>USER:<\/strong>Name of the owner of the process.<\/li>\n<li><strong>PR:<\/strong>Process priority.<\/li>\n<li><strong>NI:<\/strong>The nice value of the process.<\/li>\n<li><strong>VIRT:<\/strong>Virtual memory used by the process.<\/li>\n<li><strong>RES:<\/strong>Resident memory used by the process.<\/li>\n<li><strong>SHR:<\/strong>Shared memory used by the process.<\/li>\n<li><strong>S:<\/strong>Status of the process. (See the list of values this field can take below).<\/li>\n<li><strong>%CPU:<\/strong>The share of CPU time used by the process since the last update.<\/li>\n<li><strong>%MEM:<\/strong>The share of physical memory used.<\/li>\n<li><strong>TIME+:<\/strong>Total CPU time used by the task in 100ths of a second.<\/li>\n<li><strong>COMMAND:<\/strong>The Command name or line (name + options). (This column is offscreen to the right in the image above.)<\/li>\n<\/ul>\n<p>The status displayed in the\u00a0S\u00a0column can be one of the following:<\/p>\n<ul>\n<li><strong>D:<\/strong>Uninterruptible sleep.<\/li>\n<li><strong>R:<\/strong><\/li>\n<li><strong>S:<\/strong><\/li>\n<li><strong>T:<\/strong>Traced (stopped).<\/li>\n<li><strong>Z:<\/strong><\/li>\n<\/ul>\n<p>Press Q to exit\u00a0top.<\/p>\n<h2 id=\"reading-proc-meminfo\">Reading \/proc\/meminfo<\/h2>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <\/div> <pre class=\"language-sql code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-sql code-embed-code\">less \/proc\/meminfo<\/code><\/pre> <\/div>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-33002\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2020\/03\/x6-8.png.pagespeed.gpjpjwpjwsjsrjrprwricpmd.ic_.Kox0D9QWMo.png\" alt=\"\" width=\"646\" height=\"382\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2020\/03\/x6-8.png.pagespeed.gpjpjwpjwsjsrjrprwricpmd.ic_.Kox0D9QWMo.png 646w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2020\/03\/x6-8.png.pagespeed.gpjpjwpjwsjsrjrprwricpmd.ic_.Kox0D9QWMo-300x177.png 300w\" sizes=\"(max-width: 646px) 100vw, 646px\" \/><\/p>\n<div class=\"code-embed-wrapper\"> <div class=\"code-embed-infos\"> <\/div> <pre class=\"language-sql code-embed-pre line-numbers\"  data-start=\"1\" data-line-offset=\"0\"><code class=\"language-sql code-embed-code\">MemTotal:          2035260 kB<br\/>MemFree:            919064 kB<br\/>MemAvailable:      1300932 kB<br\/>Buffers:             33528 kB<br\/>Cached:             457604 kB<br\/>SwapCached:          29732 kB<br\/>Active:             313360 kB<br\/>Inactive:           603276 kB<br\/>Active(anon):        74648 kB<br\/>Inactive(anon):     355004 kB<br\/>Active(file):       238712 kB<br\/>Inactive(file):     248272 kB<br\/>Unevictable:            16 kB<br\/>Mlocked:                16 kB<br\/>SwapTotal:         1557568 kB<br\/>SwapFree:           873024 kB<br\/>Dirty:                  80 kB<br\/>Writeback:               0 kB<br\/>AnonPages:          414100 kB<br\/>Mapped:              97436 kB<br\/>Shmem:                4148 kB<br\/>KReclaimable:        52932 kB<br\/>Slab:                94216 kB<br\/>SReclaimable:        52932 kB<br\/>SUnreclaim:          41284 kB<br\/>KernelStack:          9280 kB<br\/>PageTables:          45264 kB<br\/>NFS_Unstable:            0 kB<br\/>Bounce:                  0 kB<br\/>WritebackTmp:            0 kB<br\/>CommitLimit:       2575196 kB<br\/>Committed_AS:      5072192 kB<br\/>VmallocTotal:  34359738367 kB<br\/>VmallocUsed:         35712 kB<br\/>VmallocChunk:            0 kB<br\/>Percpu:                720 kB<br\/>HardwareCorrupted:       0 kB<br\/>AnonHugePages:           0 kB<br\/>ShmemHugePages:          0 kB<br\/>ShmemPmdMapped:          0 kB<br\/>CmaTotal:                0 kB<br\/>CmaFree:                 0 kB<br\/>HugePages_Total:         0<br\/>HugePages_Free:          0<br\/>HugePages_Rsvd:          0<br\/>HugePages_Surp:          0<br\/>Hugepagesize:         2048 kB<br\/>Hugetlb:                 0 kB<br\/>DirectMap4k:        180160 kB<br\/>DirectMap2M:       1916928 kB<\/code><\/pre> <\/div>\n<p>All sizes are in kibibytes\u00a0unless otherwise indicated. Here\u2019s what they all mean, along with some others you might see depending on your computer\u2019s configuration and hardware:<\/p>\n<ul>\n<li style=\"text-align: justify;\">\u00a0 MemTotal:\u00a0Total usable RAM (apart from a few reserved bits and the kernel binary code).<\/li>\n<li style=\"text-align: justify;\">\u00a0 MemFree:\u00a0The sum of\u00a0LowFree+HighFree. The amount of RAM currently available.<\/li>\n<li style=\"text-align: justify;\">\u00a0 MemAvailable:\u00a0Estimated memory available to start new applications, without swapping.<\/li>\n<li style=\"text-align: justify;\">\u00a0 Buffers:\u00a0Temporary storage for raw disk blocks. This reduces hard drive in- and output. It also speeds up access to subsequent requests for the same data because it\u2019s already in memory.<\/li>\n<li style=\"text-align: justify;\">\u00a0 Cached:\u00a0Cached pages read from files on the hard drive (not including\u00a0SwapCached).<\/li>\n<li style=\"text-align: justify;\">\u00a0 SwapCached:\u00a0Memory that was swapped out and back in, and a copy remains in the swap space.<\/li>\n<li style=\"text-align: justify;\">\u00a0 Active:\u00a0Memory used recently. It\u2019s not reclaimed unless absolutely necessary.<\/li>\n<li style=\"text-align: justify;\">\u00a0 Inactive:\u00a0Memory that\u2019s been used, but not the most recently used. It\u2019s a likely candidate for reclamation.<\/li>\n<li style=\"text-align: justify;\">\u00a0 Active(anon):\u00a0Memory allocated to files created in a\u00a0tmpfs\u00a0pseudo-file system. Anonymous files don\u2019t reside on the hard drive.<\/li>\n<li style=\"text-align: justify;\">\u00a0 Inactive(anon):\u00a0Amount of anonymous,\u00a0tmpfs, and\u00a0shmem\u00a0memory that\u2019s a candidate for eviction (memory reclamation).<\/li>\n<li style=\"text-align: justify;\">\u00a0 Active(file):\u00a0Amount of file cache memory in use, or that has been used since the previous memory reclamation cycle.<\/li>\n<li style=\"text-align: justify;\">\u00a0 Inactive(file):\u00a0Amount of file cache memory read from a hard drive that is a candidate for reclaiming.<\/li>\n<li style=\"text-align: justify;\">\u00a0 Unevictable:\u00a0Amount of memory that should be evictable, but isn\u2019t because it\u2019s locked into memory by user-space processes.<\/li>\n<li style=\"text-align: justify;\">\u00a0 Mlocked:\u00a0Total amount of memory not evictable because it\u2019s locked by user-space processes.<\/li>\n<li style=\"text-align: justify;\">\u00a0 HighTotal:\u00a0Total amount of HighMem, which is used by user-space programs and page cache. The kernel can access this memory zone, but it\u2019s slower for it to access than LowMem.<\/li>\n<li style=\"text-align: justify;\">\u00a0 HighFree:\u00a0Amount of free HighMem.<\/li>\n<li style=\"text-align: justify;\">\u00a0 LowTotal:\u00a0Amount of LowMem, which is available for all the same uses as HighMem, but also for the kernel to use for its own purposes.<\/li>\n<li style=\"text-align: justify;\">\u00a0 LowFree:\u00a0Amount of free LowMem.<\/li>\n<li style=\"text-align: justify;\">\u00a0 MmapCopy:\u00a0Amount of memory that\u2019s been mapped to file data.<\/li>\n<li style=\"text-align: justify;\">\u00a0 SwapTotal:\u00a0Total amount of swap space available.<\/li>\n<li style=\"text-align: justify;\">\u00a0 SwapFree:\u00a0Amount of swap space that\u2019s currently unused.<\/li>\n<li style=\"text-align: justify;\">\u00a0 Dirty:\u00a0Amount of memory waiting to be written back to the disk.<\/li>\n<li style=\"text-align: justify;\">\u00a0 Writeback:\u00a0Memory actively being written back to the disk.<\/li>\n<li style=\"text-align: justify;\">\u00a0 AnonPages:\u00a0Non-file backed pages mapped into user-space page tables.<\/li>\n<li style=\"text-align: justify;\">\u00a0 Mapped:\u00a0Files (like libraries) that are mapped into memory.<\/li>\n<li style=\"text-align: justify;\">\u00a0 Shmem:\u00a0Amount of memory consumed in\u00a0tmpfs\u00a0pseudo-file systems.<\/li>\n<li style=\"text-align: justify;\">\u00a0 KReclaimable:\u00a0Kernel memory allocations the kernel will attempt to reclaim if the demand for memory is severe enough.<\/li>\n<li style=\"text-align: justify;\">\u00a0 Slab:\u00a0In-kernel data structures cache.<\/li>\n<li style=\"text-align: justify;\">\u00a0 SReclaimable:\u00a0Amount of\u00a0Slab\u00a0memory that might be reclaimed, such as caches.<\/li>\n<li style=\"text-align: justify;\">\u00a0 SUnreclaim:\u00a0Amount of\u00a0Slab\u00a0memory that can\u2019t be reclaimed.<\/li>\n<li style=\"text-align: justify;\">\u00a0 KernelStack:\u00a0Amount of memory allocated to kernel stacks.<\/li>\n<li style=\"text-align: justify;\">\u00a0 PageTables:\u00a0Amount of memory dedicated to the lowest level of page tables.<\/li>\n<li style=\"text-align: justify;\">\u00a0 Quicklists:\u00a0Because the allocation and deletion of page tables is a very frequent operation, it\u2019s vital that\u2019s it\u2019s as quick as possible. So, the pages used for page tables are cached in a number of different lists called \u201cquicklists.\u201d<\/li>\n<li style=\"text-align: justify;\">\u00a0 NFS_Unstable: (NFS) pages the server has received, but not yet written to non-volatile storage.<\/li>\n<li style=\"text-align: justify;\">\u00a0 Bounce:\u00a0Memory used for block device bounce buffers.\u00a0A bounce buffer is positioned in memory low enough for a device to directly access it. The data is then copied to the desired user page in HighMem.<\/li>\n<li style=\"text-align: justify;\">\u00a0 WritebackTmp:\u00a0Memory used by\u00a0(FUSE) for temporary write-back buffers.<\/li>\n<li style=\"text-align: justify;\">\u00a0 CommitLimit:\u00a0The total amount of memory currently available to be allocated in the system.<\/li>\n<\/ul>\n<p>Committed_AS:\u00a0The amount of memory estimated to satisfy all current demands. If a program requests some RAM, the request is recorded, but the RAM is only allocated once the program starts to use it. It\u2019s also only allocated as required, up to the maximum amount the program reserved. More memory can be \u201callocated\u201d than can actually be delivered. If all programs try to cash in their RAM chips at once, the memory casino might go bust (and have to go cap in hand to the swap-space financiers).<\/p>\n<ul>\n<li style=\"text-align: justify;\">\u00a0 VmallocTotal: Total size of the vmlloc memory area.<\/li>\n<li style=\"text-align: justify;\">\u00a0 VmallocUsed:\u00a0Amount of vmalloc area used. Since Linux 4.4, this field is no longer calculated, it\u2019s hard-coded.<\/li>\n<li style=\"text-align: justify;\">\u00a0 VmallocChunk:\u00a0Largest contiguous block of free vmalloc area.<\/li>\n<li style=\"text-align: justify;\">\u00a0 HardwareCorrupted:\u00a0Amount of memory tagged as having physical memory corruption problems. It won\u2019t be allocated.<\/li>\n<li style=\"text-align: justify;\">\u00a0 LazyFree: Amount of memory in MADV_FREE state. When an application sets the MADV_FREEflag on a range of pages and they\u2019re now reclamation candidates. Actual reclamation might be delayed until there\u2019s sufficient demand for memory. If the application starts to write to pages, the reclamation can be canceled.<\/li>\n<li style=\"text-align: justify;\">\u00a0 AnonHugePages:\u00a0Non-file backed huge pages mapped into user-space page tables. Non-file backed pages didn\u2019t come from a hard drive file.<\/li>\n<li style=\"text-align: justify;\">\u00a0 ShmemHugePages:\u00a0Amount of memory used by shared memory (shmem) and pseudo-file systems (tmpfs) allocated with huge pages.<\/li>\n<li style=\"text-align: justify;\">\u00a0 ShmemPmdMapped:\u00a0Amount of shared memory mapped into user-space with huge pages.<\/li>\n<li style=\"text-align: justify;\">\u00a0 CmaTotal:\u00a0Amount of CMA (Contiguous Memory Allocator) pages. These are used by devices that can only communicate to contiguous regions of memory.<\/li>\n<li style=\"text-align: justify;\">\u00a0 CmaFree:\u00a0Amount of free CMA (Contiguous Memory Allocator) pages.<\/li>\n<li style=\"text-align: justify;\">\u00a0 HugePages_Total:\u00a0Huge page pool size.<\/li>\n<li style=\"text-align: justify;\">\u00a0 HugePages_Free:\u00a0Number of unallocated huge pages in the pool.<\/li>\n<li style=\"text-align: justify;\">\u00a0 HugePages_Rsvd:\u00a0Number of reserved huge pages. The commitment to allocate has been made, but allocation hasn\u2019t occurred yet.<\/li>\n<li style=\"text-align: justify;\">\u00a0 HugePages_Surp:\u00a0Number of huge pages in the pool above the defined system value.<\/li>\n<li style=\"text-align: justify;\">\u00a0 Hugepagesize:\u00a0Size of huge pages.<\/li>\n<li style=\"text-align: justify;\">\u00a0 DirectMap4k:\u00a0Number of bytes of RAM mapped to 4 kB pages.<\/li>\n<li style=\"text-align: justify;\">\u00a0 DirectMap4M:\u00a0Number of bytes of RAM mapped to 4 MB pages.<\/li>\n<li style=\"text-align: justify;\">\u00a0 DirectMap2M:\u00a0Number of bytes of RAM mapped to 2 MB pages.<\/li>\n<li style=\"text-align: justify;\">\u00a0 DirectMap1G:\u00a0Number of bytes of RAM mapped to 2 GB pages.<\/li>\n<\/ul>\n<p>Linux, there\u2019s more than one way to get a quick overview, and always at least one way to go deeper into the details.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are plenty of ways you can get the lowdown on memory usage within your Linux system. In this roundup, we\u2019ll cover the most commonly used command-line methods: free, vmstat, and top. We\u2019ll also look at reading \/proc\/meminfo directly. How Linux Uses RAM RAM is a finite resource that all processes, like applications and daemons, [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":32991,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[86817],"tags":[86770,86771,44503],"class_list":["post-32988","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-how-to-check-memory-usage","tag-check-memory-usage","tag-check-ram","tag-linux-terminal"],"_links":{"self":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts\/32988","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/comments?post=32988"}],"version-history":[{"count":0,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts\/32988\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/media\/32991"}],"wp:attachment":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/media?parent=32988"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/categories?post=32988"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/tags?post=32988"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}