{"id":1761,"date":"2021-07-05T11:52:28","date_gmt":"2021-07-05T06:22:28","guid":{"rendered":"https:\/\/coimbatorewebhosting.com\/blog\/?p=1761"},"modified":"2021-07-17T11:00:21","modified_gmt":"2021-07-17T05:30:21","slug":"how-to-check-memory-usage-on-centos-server","status":"publish","type":"post","link":"https:\/\/coimbatorewebhosting.com\/blog\/how-to-check-memory-usage-on-centos-server\/","title":{"rendered":"How to check memory usage on CentOS Server"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/coimbatorewebhosting.com\/blog\/wp-content\/uploads\/2021\/07\/memory.png\" alt=\"Memory\" class=\"aligncenter size-full wp-image-1792\" width=\"700\" height=\"302\" srcset=\"https:\/\/coimbatorewebhosting.com\/blog\/wp-content\/uploads\/2021\/07\/memory.png 700w, https:\/\/coimbatorewebhosting.com\/blog\/wp-content\/uploads\/2021\/07\/memory-300x129.png 300w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/p>\n<p><a href=\"https:\/\/www.squarebrothers.com\/linux-web-hosting-india\/\" target=\"_blank\" rel=\"noopener nofollow\">Linux operating system<\/a> comes with many commands to check memory usage. The \u201cfree\u201d command usually displays the total amount of free and used physical and swap memory in the system, as well as the buffers used by the kernel. The \u201ctop\u201d command provides a dynamic real-time view of a running system.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-235\" src=\"https:\/\/i0.wp.com\/chennaihosting.net\/blog\/wp-content\/uploads\/2019\/02\/RAM.jpg?resize=579%2C326\" alt=\"memory usage\" data-recalc-dims=\"1\" width=\"579\" height=\"326\" \/><\/p>\n<p>The top command can display system summary information as well as a list of the process currently being managed by the Linux kernel.<\/p>\n<p>In this article we will see the ways to check the memory usage on <a href=\"https:\/\/www.centos.org\/\" target=\"_blank\" rel=\"noopener nofollow\">CentOS<\/a>.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/coimbatorewebhosting.com\/blog\/how-to-check-memory-usage-on-centos-server\/#Checking_memory_usage_on_CentOS\" >Checking memory usage on CentOS<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/coimbatorewebhosting.com\/blog\/how-to-check-memory-usage-on-centos-server\/#free_Command\" >free Command<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/coimbatorewebhosting.com\/blog\/how-to-check-memory-usage-on-centos-server\/#where_Command\" >where Command<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/coimbatorewebhosting.com\/blog\/how-to-check-memory-usage-on-centos-server\/#vmstat_command\" >vmstat command<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/coimbatorewebhosting.com\/blog\/how-to-check-memory-usage-on-centos-server\/#atop_command\" >atop command<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/coimbatorewebhosting.com\/blog\/how-to-check-memory-usage-on-centos-server\/#htop_command\" >htop command<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/coimbatorewebhosting.com\/blog\/how-to-check-memory-usage-on-centos-server\/#top_command\" >top command<\/a><\/li><\/ul><\/nav><\/div>\n<h4 class=\"fittexted_for_content_h4\"><span class=\"ez-toc-section\" id=\"Checking_memory_usage_on_CentOS\"><\/span>Checking memory usage on CentOS<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>Follow the below command to check memory usage on <a href=\"https:\/\/www.coimbatorewebhosting.com\/unlimited-coimbatore-web-hosting\/\" target=\"_blank\" rel=\"noopener\">Linux machine<\/a>.<\/p>\n<pre>\/proc\/meminfo<\/pre>\n<p>You can check memory usage is to read the \/proc\/meminfo file. The same file is used to know the free and other utilities <a href=\"https:\/\/coimbatorewebhosting.com\/blog\/how-to-disable-selinux-on-centos\/\" title=\"report\" alt=\"report\">report<\/a> of free and used memory (both physical and swap) on the system.<\/p>\n<pre># cat \/proc\/meminfo\r\nor\r\n# egrep --color 'Mem|Cache|Swap' \/proc\/meminfo<\/pre>\n<p>&nbsp;<\/p>\n<p>You will get some output like below:<\/p>\n<pre>MemTotal:   7996284 kB\r\nMemFree:    5415608 kB\r\nCached:       92416 kB\r\nSwapCached:   35924 kB\r\nSwapTotal:  8187836 kB\r\nSwapFree:   8059332 kB<\/pre>\n<h4 class=\"fittexted_for_content_h4\"><span class=\"ez-toc-section\" id=\"free_Command\"><\/span>free Command<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>You can check the total free and used physical and swap memory as well as the buffer used using free command.<\/p>\n<pre># free -m<\/pre>\n<p>You will get some output like below:<\/p>\n<pre>             total       used       free     shared    buffers     cached\r\nMem:          1006        317        689          0         36        190\r\n-\/+ buffers\/cache:         90        916\r\nSwap:         2015          0       2015\r\n<\/pre>\n<h4 class=\"fittexted_for_content_h4\"><span class=\"ez-toc-section\" id=\"where_Command\"><\/span>where Command<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>The whereis command lets users locate binary, source, and manual page files for a command. Following is its syntax:<\/p>\n<pre>Whereis [options]<\/pre>\n<pre>-b,-k,-m,-g: show output in bytes, KB, MB, or GB\r\n\u2013l: show detailed low and high memory statistics\r\n\u2013o: use old format (no -\/+buffers\/cache line)\r\n\u2013t: display total for RAM + swap\r\n\u2013s: update every [delay] seconds\r\n\u2013c: update [count] times<\/pre>\n<h4 class=\"fittexted_for_content_h4\"><span class=\"ez-toc-section\" id=\"vmstat_command\"><\/span>vmstat command<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>vmstat reports information about processes, memory, paging, block IO, traps, and cpu activity.<\/p>\n<pre># vmstat<\/pre>\n<p>You will some output like below:<\/p>\n<pre>procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----\r\n r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st\r\n 0  0      0 701072  38236 198804    0    0    18    23   88   97  1  3 96  1  0\r\n<\/pre>\n<p>The vmstat command with the s option, lays out the memory usage statistics much like the proc command.<\/p>\n<pre># vmstat -s<\/pre>\n<p>You will some output like below:<\/p>\n<pre>7996284    total memory\r\n3028732    used memory\r\n2587708    active memory\r\n253600     inactive memory\r\n4967552    free memory\r\n32212      buffer memory\r\n97732      swap cache\r\n8187836    total swap\r\n127572     used swap\r\n8060264    free swap\r\n2629730    non-nice user cpu ticks\r\n890        nice user cpu ticks\r\n335618     system cpu ticks\r\n80671997   idle cpu ticks\r\n14269700   IO-wait cpu ticks\r\n8          IRQ cpu ticks\r\n12963      softirq cpu ticks\r\n0          stolen cpu ticks\r\n320259348  pages paged in\r\n496267028  pages <a href=\"https:\/\/coimbatorewebhosting.com\/blog\/how-to-set-up-soa-records-for-email-accounts\/\" title=\"paged\" alt=\"paged\">paged<\/a> out\r\n40038      pages swapped in\r\n85154      pages swapped out\r\n151875583  interrupts\r\n278983792  CPU context switches\r\n1438090342 boot time\r\n300883     forks<\/pre>\n<h4 class=\"fittexted_for_content_h4\"><span class=\"ez-toc-section\" id=\"atop_command\"><\/span>atop command<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>The program atop is an interactive monitor to view the load on a Linux system. This program can display the amount of used and free memory, i.e. cpu, memory, disk and network.<\/p>\n<pre># atop<\/pre>\n<h4 class=\"fittexted_for_content_h4\"><span class=\"ez-toc-section\" id=\"htop_command\"><\/span>htop command<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>It is similar to top, also <a href=\"https:\/\/coimbatorewebhosting.com\/blog\/disable-ssh-root-login-permit-su\/\" title=\"allows\" alt=\"allows\">allows<\/a> you to see all the processes running on the system, with their full command lines.<\/p>\n<pre>#htop<\/pre>\n<h4 class=\"fittexted_for_content_h4\"><span class=\"ez-toc-section\" id=\"top_command\"><\/span>top command<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>The Linux top command is used to show all the running processes within your Linux environment.<\/p>\n<pre> #top<\/pre>\n<p>or<\/p>\n<pre> # top c<\/pre>\n<p>Hope, this article helps you. Please share your valuable feedback to improve us.<\/p>\n<p>To monitor the real time resource usage in Cloud linux: <a href=\"http:\/\/www.webhostingchennai.co.in\/blog\/monitor-real-time-resource-usage-in-cloudlinux\/\" rel=\"nofollow noopener\" target=\"_blank\">Click here<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Linux operating system comes with many commands to check memory usage. The \u201cfree\u201d command usually displays the total amount of free and used physical and swap memory in the system, as well as the buffers used by the kernel. The \u201ctop\u201d command provides a dynamic real-time view of a running [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1792,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[153,17,3,1],"tags":[],"class_list":["post-1761","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos-7-rhel-7","category-general","category-linux","category-latest"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/coimbatorewebhosting.com\/blog\/wp-content\/uploads\/2021\/07\/memory.png","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pa2YU7-sp","_links":{"self":[{"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/posts\/1761","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/comments?post=1761"}],"version-history":[{"count":0,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/posts\/1761\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/media\/1792"}],"wp:attachment":[{"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/media?parent=1761"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/categories?post=1761"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/coimbatorewebhosting.com\/blog\/wp-json\/wp\/v2\/tags?post=1761"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}