{"id":1023,"date":"2018-06-11T04:13:54","date_gmt":"2018-06-11T04:13:54","guid":{"rendered":"http:\/\/jaipurhosting.com\/blog\/?p=1023"},"modified":"2019-04-27T11:49:40","modified_gmt":"2019-04-27T06:19:40","slug":"how-to-check-memory-usage-in-centos-using-free-commands","status":"publish","type":"post","link":"https:\/\/www.jaipurhosting.com\/blog\/how-to-check-memory-usage-in-centos-using-free-commands\/","title":{"rendered":"How to check Memory Usage in centos using &#8216;free&#8217; commands"},"content":{"rendered":"<p><strong>Description&nbsp;<\/strong><\/p>\n<p>Linux is one of the most popular open source operating system and comes with huge set of commands.<\/p>\n<p>The most important and single way of determining the total available space of the physical memory and swap memory is by using \u201c<strong>free<\/strong>\u201d command.<\/p>\n<p>The Linux \u201c<strong>free<\/strong>\u201d command gives information about total used and available space of <strong>physical memory<\/strong> and <strong>swap memory<\/strong> with buffers used by kernel in Linux\/Unix like operating systems.<\/p>\n<p>This article provides some useful examples of \u201c<strong>free<\/strong>\u201d commands with options, that might be useful for you to better utilize memory that you have.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>1. Display System Memory<\/strong><\/p>\n<p>Free command used to check the used and available space of <strong>physical memory and swap memory<\/strong> in <strong>KB<\/strong>.<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true\">[root@vps ~]# free\n              total        used        free      shared  buff\/cache   available\nMem:        1012436       53864      197272       25552      761300      903124\nSwap:       2097148           0     2097148\n<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>2. Display Memory in Bytes<\/strong><\/p>\n<p>Free command with option <strong>-b<\/strong>, display the size of memory in <strong>Bytes<\/strong><\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">[root@vps ~]# free -b\n              total        used        free      shared  buff\/cache   available\nMem:     1036734464    52916224   204431360    26132480   779386880   927121408\nSwap:    2147479552           0  2147479552\n<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>3. Display Memory in Kilo Bytes<\/strong><\/p>\n<p>Free command with option <strong>-k<\/strong>, display the size of memory in (<strong>KB<\/strong>) <strong>Kilobytes<\/strong><\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">[root@vps ~]# free -k\n              total        used        free      shared  buff\/cache   available\nMem:        1012436       51548      199764       25520      761124      905520\nSwap:       2097148           0     2097148\n<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>4. Display Memory in Megabytes<\/strong><\/p>\n<p>To see the size of the memory in (<strong>MB<\/strong>) <strong>Megabytes<\/strong> use option as <strong>-m<\/strong>.<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">[root@vps ~]# free -m\n              total        used        free      shared  buff\/cache   available\nMem:            988          50         195          24         743         884\nSwap:          2047           0        2047<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>5. Display Memory in Gigabytes<\/strong><\/p>\n<p>Using <strong>-g<\/strong> option with free command, would display the size of the memory in <strong>GB<\/strong>(<strong>Gigabytes<\/strong>).<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">[root@vps ~]# free -g\n              total        used        free      shared  buff\/cache   available\nMem:              0           0           0           0           0           0\nSwap:             1           0           1<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>6. Display Total Line<\/strong><\/p>\n<p>Free command with <strong>-t<\/strong> option, will list the total line at the end.<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">[root@vps ~]# free -t\n              total        used        free      shared  buff\/cache   available\nMem:        1012436       51548      199764       25520      761124      905520\nSwap:       2097148           0     2097148\nTotal:      3109584       51548     2296912\n<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>7. Disable Display of Buffer Adjusted Line<\/strong><\/p>\n<p>By default the free command display \u201c<strong>buffer adjusted<\/strong>\u201d line, to disable this line use option as <strong>-o<\/strong>.<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">[root@vps ~]# free -o\ntotal       used       free     shared    buffers     cached\nMem:       1021628     912520     109108          0     120368     655548\nSwap:      4194296          0    4194296<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>8. Display Memory Status for Regular Intervals<\/strong><\/p>\n<p>The <strong>-s<\/strong> option with number, used to update free command at regular intervals.<\/p>\n<p>For example, the below command will update free command every 5 seconds.<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">[root@vps ~]# free -s 5\n              total        used        free      shared  buff\/cache   available\nMem:        1012436       51672      199640       25520      761124      905396\nSwap:       2097148           0     2097148\n<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>9. Show Low and High Memory Statistics<\/strong><\/p>\n<p>The <strong>-l<\/strong> switch displays detailed <strong>high<\/strong> and <strong>low memory<\/strong> size statistics.<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">[root@vps ~]# free 1\n              total        used        free      shared  buff\/cache   available\nMem:        1012436       51652      199660       25520      761124      905416\nSwap:       2097148           0     2097148<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>10. Check Free Version<\/strong><\/p>\n<p>The <strong>-V<\/strong> option, display free command version information.<\/p>\n<pre class=\"theme:dark-terminal lang:default decode:true \">[root@vps ~]# free -V\nfree from procps-ng 3.3.10\n<\/pre>\n<p>&nbsp;<\/p>\n<p>We hope you\u2019ve found this useful!<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Description&nbsp; Linux is one of the most popular open source operating system and comes with huge set of commands. The most important and single way of determining the total available space of the physical memory and swap memory is by using \u201cfree\u201d command. The Linux \u201cfree\u201d command gives information about total used and available space [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1301,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-1023","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts\/1023","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/comments?post=1023"}],"version-history":[{"count":2,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts\/1023\/revisions"}],"predecessor-version":[{"id":1549,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/posts\/1023\/revisions\/1549"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/media\/1301"}],"wp:attachment":[{"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/media?parent=1023"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/categories?post=1023"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jaipurhosting.com\/blog\/wp-json\/wp\/v2\/tags?post=1023"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}