{"id":3106,"date":"2025-02-19T12:05:11","date_gmt":"2025-02-19T12:05:11","guid":{"rendered":"https:\/\/foghosting.com\/5-best-commands-to-check-memory-usage-in-linux\/"},"modified":"2025-02-19T12:05:11","modified_gmt":"2025-02-19T12:05:11","slug":"5-best-commands-to-check-memory-usage-in-linux","status":"publish","type":"post","link":"https:\/\/foghosting.com\/blog\/5-best-commands-to-check-memory-usage-in-linux\/","title":{"rendered":"5 Best Commands to Check Memory Usage in Linux"},"content":{"rendered":"<div>\n<h2><span id=\"Introduction\">Introduction<\/span><\/h2>\n<p>For managing and enhancing your system, Linux includes a variety of built-in utilities. To make the most of Linux when you\u2019re a newbie to it or decided to switch from Windows, you\u2019ll now have to learn a few commands. Linux is best known as an extremely user- or administrator-friendly operating system. No matter what version of Linux you use\u2014Ubuntu, Mint, Debian, or another\u2014you can accomplish anything with the appropriate tools and instructions.<\/p>\n<p>We\u2019ll concentrate on how to monitor the memory use on Linux in this post because it\u2019s an essential skill to know.<\/p>\n<p>All necessary information is accessible and can get tracked down with a few easy terminal commands. Learn five effective Linux commands in this guide to check your system\u2019s memory use.<\/p>\n<figure><\/figure>\n<h3><span id=\"Linux_Memory_Details_Displayed_by_the_Cat_Command\">Linux Memory Details Displayed by the Cat Command<\/span><\/h3>\n<p>You could access the \/proc\/meminfo file by typing cat \/proc\/meminfo on your terminal.<\/p>\n<figure><\/figure>\n<p>The quantity of available and utilized RAM gets reported by this virtual file. The kernel\u2019s use of shared memory and buffers, along with the system\u2019s memory utilization in real time, are all covered. Depending on the structure and system software in use, the outcome could change slightly.<\/p>\n<p>With Ubuntu 18.04, the \/proc\/meminfo file appears like this for an example:<\/p>\n<p>The data get shown on the terminal in kilobytes.<\/p>\n<h3><span id=\"Free_Command_to_See_the_Physical_as_well_as_Swap_Memory_Capacity\">Free Command to See the Physical as well as Swap Memory Capacity<\/span><\/h3>\n<p>This is what happens when you type \u201cfree\u201d on your command terminal:<\/p>\n<figure><\/figure>\n<p>In kilobytes, the data shows the amounts of swap memory that get consumed and accessible.<\/p>\n<figure>\n<table readabilityDataTable=\"1\">\n<tbody>\n<tr>\n<td>total<\/td>\n<td>the total amount of installed memory<\/td>\n<\/tr>\n<tr>\n<td>used<\/td>\n<td>Now active processes\u2019 consumption of memory (used = total \u2013 free \u2013 buff\/cache)<\/td>\n<\/tr>\n<tr>\n<td>free<\/td>\n<td>Memory that has not getting utilized (free = total \u2013 used \u2013 buff\/cache)<\/td>\n<\/tr>\n<tr>\n<td>shared<\/td>\n<td>several processes share the same memory<\/td>\n<\/tr>\n<tr>\n<td>buffers<\/td>\n<td>Memory is set aside by the System for allocating as buffers when processes require them<\/td>\n<\/tr>\n<tr>\n<td>cached<\/td>\n<td>RAM-based storage for recently used files<\/td>\n<\/tr>\n<tr>\n<td>buff\/cache<\/td>\n<td>Cache plus buffers<\/td>\n<\/tr>\n<tr>\n<td>available<\/td>\n<td>a calculation of the amount of memory that is available for fresh application startup without swapping.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<p>The free command offers far less information than the \/proc\/meminfo file. But it is simpler to comprehend. The important number is the available value, which shows how much RAM is still accessible for freshly developed applications to run.<\/p>\n<p>To format the result to better meet your needs, the free command offers a wide range of options. The most practical free command variants get listed in the table below.<\/p>\n<figure>\n<table readabilityDataTable=\"1\">\n<tbody>\n<tr>\n<td>Options<\/td>\n<td>Outcome<\/td>\n<\/tr>\n<tr>\n<td>-b<\/td>\n<td>display in bytes<\/td>\n<\/tr>\n<tr>\n<td>-k<\/td>\n<td>display in kibibytes<\/td>\n<\/tr>\n<tr>\n<td>-m<\/td>\n<td>produced in megabytes<\/td>\n<\/tr>\n<tr>\n<td>-g<\/td>\n<td>produced in gibibytes<\/td>\n<\/tr>\n<tr>\n<td>-l<\/td>\n<td>in-depth data on both high and low memory<\/td>\n<\/tr>\n<tr>\n<td>-o<\/td>\n<td>outdated format (no line for -\/+buffers\/cache)<\/td>\n<\/tr>\n<tr>\n<td>-t<\/td>\n<td>total RAM + swap<\/td>\n<\/tr>\n<tr>\n<td>-s<\/td>\n<td>synchronize every [delay] second<\/td>\n<\/tr>\n<tr>\n<td>-c<\/td>\n<td>update [count] times<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n<p>It is crucial to keep in mind that: Trying to enter man free, like with other commands, provides a list of all possible versions and explanations of the outcomes.<\/p>\n<h3><span id=\"Reporting_Virtual_Memory_Information_with_the_Vmstat_Command\">Reporting Virtual Memory Information with the Vmstat Command<\/span><\/h3>\n<figure><\/figure>\n<p>A helpful tool for reporting virtual memory statistics would be the vmstat command.<\/p>\n<p>A broad overview of processes, storage, paging, blocks IO, traps, as well as CPU activity gets provided by vmstat.<\/p>\n<figure><\/figure>\n<p>If you require assistance in understanding the outcomes, refer to the thorough description mentioned below, which explains every value.<\/p>\n<h4><span id=\"Procs\"><strong>Procs<\/strong><\/span><\/h4>\n<ul>\n<li>r: the number of processes awaiting execution.<\/li>\n<li>B: The number of uninterrupted sleep processes.<\/li>\n<\/ul>\n<h4><span id=\"Memory\"><strong>Memory<\/strong><\/span><\/h4>\n<ul>\n<li>Virtual memory usage got reported by SWPD.<\/li>\n<li>free: the proportion of memory that isn\u2019t getting used.<\/li>\n<li>buff: The total space allocated for buffers.<\/li>\n<li>cache: The total memory capacity used for cache.<\/li>\n<\/ul>\n<h4><span id=\"Swap\"><strong>Swap<\/strong><\/span><\/h4>\n<ul>\n<li>si: Memory got switched in from the disc (\/s).<\/li>\n<li>So: switched to disc from memory (\/s).<\/li>\n<\/ul>\n<h4><span id=\"IO\"><strong>IO<\/strong><\/span><\/h4>\n<ul>\n<li>bi: The number of blocks (blocks\/s) that got collected from a block device.<\/li>\n<li>b: The number of blocks transferred per second to a block device.<\/li>\n<\/ul>\n<h4><span id=\"System\"><strong>System<\/strong><\/span><\/h4>\n<ul>\n<li>in: the number of interruptions per sec, along with the clock.<\/li>\n<li>cs: the quantity of context flips per sec.<\/li>\n<\/ul>\n<h2><span id=\"These_Percentages_Represent_the_Overall_Amount_of_CPU_Time\">These Percentages Represent the Overall Amount of CPU Time.<\/span><\/h2>\n<ul>\n<li>us: Time used for non-kernel code execution. (User time, nice time included)<\/li>\n<li>sy: The length of time spent working kernel code. (Time on the system)<\/li>\n<li>id: Length of downtime. This contains IO-wait time up until Linux 2.5.41.<\/li>\n<li>wa: The period spent holding out for IO. Formerly incorporated into idle in Linux 2.5.41.<\/li>\n<li>st: Time snatched from a virtual computer. Not known before Linux 2.6.11.<\/li>\n<\/ul>\n<h2><span id=\"Top_Command_to_Examine_Memory_Usage\">Top Command to Examine Memory Usage<\/span><\/h2>\n<p>For examining memory and CPU utilization by process, the top command is helpful. It provides details about:<\/p>\n<ul>\n<li>uptime<\/li>\n<li>standard load<\/li>\n<li>operating tasks<\/li>\n<li>amount of users who have logged in<\/li>\n<li>CPU utilization\/number of CPUs<\/li>\n<li>Memory\/system process swap<\/li>\n<\/ul>\n<figure><\/figure>\n<p>You can track the procedures in real time because the information gets modified consistently.<\/p>\n<p>The top command offers a constrained interactive interface in addition to giving you significant memory information. With command-line parameters, it is possible to modify and customize operations.<\/p>\n<p>A complete list of all accessible variants gets provided by the man command in Linux man top.<\/p>\n<h2><span id=\"Finding_Each_Processs_Memory_Load_with_the_htop_Command\">Finding Each Process\u2019s Memory Load with the htop Command<\/span><\/h2>\n<p>Similar data get presented by the top command as well as the htop command. The htop command\u2019s user-friendly interface and enhanced controls, meanwhile, are its genuine benefits.<\/p>\n<figure><\/figure>\n<p>The command supports both vertical as well as horizontal scrolling, incorporates color for its output, also offers complete command lines for processes.<\/p>\n<ul>\n<li>htop<\/li>\n<\/ul>\n<p>The following result gets displayed:<\/p>\n<ul>\n<li>The top section comprises text counters and graphic meters that display summary data.<\/li>\n<li>The detailed data get organized per process in the lower portion. You can easily take action on particular processes according to this.<\/li>\n<li>You could rapidly manage and adjust the processes using the shortcuts provided at the bottom of the screen without having to enter precise commands.<\/li>\n<\/ul>\n<p>It is important to keep in mind that you must install the htop functions first if you encounter the \u201cCommand \u2018htop\u2019 not found\u201d error while attempting to run the htop command:<\/p>\n<pre><code>sudo snap install htop<\/code><\/pre>\n<figure><\/figure>\n<p>Use the following command as an effective solution:<\/p>\n<pre><code>sudo apt install htop<\/code><\/pre>\n<figure><\/figure>\n<h2><span id=\"Checking_Memory_Usage_in_Linux_using_the_GUI\">Checking Memory Usage in Linux using the GUI<\/span><\/h2>\n<figure><\/figure>\n<p>A graphical interface is not typically used for server administration. Yet, other data sets are far more understandable and provide a visual display of memory utilization.<\/p>\n<ul>\n<li>a System Monitor can get accessed by:<\/li>\n<li>Choose Display Applications from the menu.<\/li>\n<li>Open the application by typing System Monitor into the search box.<\/li>\n<li>Pick out the Resources tab.<\/li>\n<li>The display provides a real-time, graphical breakdown of your memory usage, along with historical data.<\/li>\n<\/ul>\n<figure><\/figure>\n<figure><\/figure>\n<p>Also Read: How to Update Git Version on Linux, Windows, Mac?<\/p>\n<h2><span id=\"Conclusion\">Conclusion<\/span><\/h2>\n<p>Many choices got presented in this article for you to examine your Linux system\u2019s memory consumption. We discovered that a single command generates a significant amount of insightful data for project undertaking. It\u2019s important to learn the proper way to understand the data.<\/p>\n<p>You could now manage your server better and more effectively.<\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Introduction For managing and enhancing your system, Linux includes a variety of built-in utilities. To make the most of Linux when you\u2019re a newbie to it or decided to switch from Windows, you\u2019ll now have to learn a few commands. Linux is best known as an extremely user- or administrator-friendly operating system. No matter what<\/p>\n","protected":false},"author":3,"featured_media":3076,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[17],"tags":[],"class_list":["post-3106","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dedicated-servers"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/foghosting.com\/blog\/wp-json\/wp\/v2\/posts\/3106","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/foghosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/foghosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/foghosting.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/foghosting.com\/blog\/wp-json\/wp\/v2\/comments?post=3106"}],"version-history":[{"count":0,"href":"https:\/\/foghosting.com\/blog\/wp-json\/wp\/v2\/posts\/3106\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/foghosting.com\/blog\/wp-json\/wp\/v2\/media\/3076"}],"wp:attachment":[{"href":"https:\/\/foghosting.com\/blog\/wp-json\/wp\/v2\/media?parent=3106"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/foghosting.com\/blog\/wp-json\/wp\/v2\/categories?post=3106"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/foghosting.com\/blog\/wp-json\/wp\/v2\/tags?post=3106"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}