{"id":845,"date":"2023-03-09T14:28:47","date_gmt":"2023-03-09T06:28:47","guid":{"rendered":"https:\/\/www.servergigabit.com\/blog\/?p=845"},"modified":"2025-12-23T14:58:54","modified_gmt":"2025-12-23T06:58:54","slug":"5-commands-to-check-memory-usage-in-linux","status":"publish","type":"post","link":"https:\/\/www.servergigabit.com\/blog\/linux\/5-commands-to-check-memory-usage-in-linux","title":{"rendered":"5 Commands to Check Memory Usage in Linux"},"content":{"rendered":"<p>&nbsp;<\/p>\n<p data-start=\"179\" data-end=\"402\">Commands to Check Memory Usage in Linux are essential for understanding how much memory is available on your system. Have you ever wondered how much memory is available on your Linux system? If you do, you&#8217;re not alone.<\/p>\n<p data-start=\"404\" data-end=\"642\">Linux\u2019s memory usage is generally lower compared to other operating systems. However, it doesn\u2019t always offer an intuitive way to check memory usage. That\u2019s why, in this article, we\u2019ll explore five ways to check memory usage in Linux.<\/p>\n<p data-start=\"644\" data-end=\"828\">We\u2019ll cover a detailed explanation of each command and how to read the results. This will help system administrators and developers use these tools to manage system memory confidently.<\/p>\n<p data-start=\"830\" data-end=\"1008\">For this tutorial, we\u2019re using <a href=\"https:\/\/ubuntu.com\/\" target=\"_blank\" rel=\"noopener\">Ubuntu<\/a> 22.04.1 LTS. You can still follow the guide using any other Linux distribution, as these command-line tools work on all Linux distributions.<\/p>\n<p data-start=\"1010\" data-end=\"1059\">To follow the guide, you must have the following:<\/p>\n<ul data-start=\"1061\" data-end=\"1246\">\n<li data-start=\"1061\" data-end=\"1116\">\n<p data-start=\"1063\" data-end=\"1116\">Access to a Linux user account with sudo privileges<\/p>\n<\/li>\n<li data-start=\"1117\" data-end=\"1167\">\n<p data-start=\"1119\" data-end=\"1167\">Access to a terminal or command-line interface<\/p>\n<\/li>\n<li data-start=\"1168\" data-end=\"1246\">\n<p data-start=\"1170\" data-end=\"1246\">Ability to install new packages, such as access to the APT package manager<\/p>\n<\/li>\n<\/ul>\n<p data-start=\"1248\" data-end=\"1266\">Let\u2019s get started.<\/p>\n<h2 id=\"table-of-contents-1\"><strong>Why Learn Commands to Check Memory Usage in Linux?<\/strong><\/h2>\n<p>Before we start, it is essential to learn about memory usage. In other words, does the knowledge of free and used memory matter?<\/p>\n<p>Each time you run a process, it consumes Random Access Memory(RAM). Without RAM, a program will not function. So, if you try to run a process that requires more memory than is currently available, it won&#8217;t run. Also, running processes in Linux changes memory usage based on users&#8217; actions. If the user tries to do an action, but the system cannot allocate it, it can crash or show an error. All of these become important if you&#8217;re running a low-spec machine.<\/p>\n<p>Sysadmins must also learn about system memory to optimize it for the best performance. This way, they can learn about rouge apps that slow down the whole system by clogging system memory. This can block new applications or even crucial Linux kernel processes.<\/p>\n<p>In addition, you can use memory usage in Linux commands to learn about the total physical memory installed on the system. It also provides information about Linux swap partitions, including other vital system info.<\/p>\n<p>On the other hand, web admins can also use these tools to check memory usage in their Linux servers. This way, they can learn whether the server can handle site visitors during peak hours. If memory usage is too high, you can always add more physical memory to handle peak traffic.<\/p>\n<p>In short, keeping a tab on memory usage in Linux lets you troubleshoot issues with your system. After all, the Linux system depends on memory and how it is utilized. So, if you&#8217;re a sysadmin or a developer, you need to know the exact amount of free and used memory alongside the server&#8217;s swap memory, kernel&#8217;s caches, and buffers.<\/p>\n<h2 id=\"table-of-contents-2\"><strong>cat Command to Show Linux Memory Usage<\/strong><\/h2>\n<p>The\u00a0<strong>cat\u00a0<\/strong>command on Linux lets you read data from files and provides output to the terminal. Here, the\u00a0<strong>cat\u00a0<\/strong>command stands for Concatenate.<\/p>\n<p>On the other hand, Linux stores all the memory usage information in the\u00a0<strong>\/proc\/meminfo<\/strong>\u00a0file.<\/p>\n<p>So, we can combine both of them to reveal information about available and used memory.<\/p>\n<p>To do so, run the Command below:<\/p>\n<p><code>cat \/proc\/meminfo<\/code><\/p>\n<p>It&#8217;ll output the real-time system&#8217;s memory usage. Moreover, it&#8217;ll also list the shared memory usage in Linux. If you&#8217;re looking for buffers&#8217; info, you&#8217;ll also get it here.<\/p>\n<p><code>cat \/proc\/meminfo<\/code><\/p>\n<p><code>#output<br \/>\nMemTotal: <\/code><\/p>\n<p><code>8090732 kB<br \/>\nMemFree: <\/code><\/p>\n<p><code>7642496 kB<br \/>\nMemAvailable: <\/code><\/p>\n<p><code>7583008 kB<br \/>\nBuffers: <\/code><\/p>\n<p><code>5912 kB<br \/>\nCached: <\/code><\/p>\n<p><code>119512 kB<br \/>\nSwapCached: <\/code><\/p>\n<p><code>0 kB<br \/>\nActive: <\/code><\/p>\n<p><code>20964 kB<br \/>\nInactive: <\/code><\/p>\n<p><code>141668 kB<br \/>\nActive(anon): <\/code><\/p>\n<p><code>1812 kB<br \/>\nInactive(anon): <\/code><\/p>\n<p><code>37632 kB<br \/>\nActive(file): <\/code><\/p>\n<p><code>19152 kB<br \/>\nInactive(file): <\/code><\/p>\n<p><code>104036 kB<br \/>\nUnevictable: <\/code><\/p>\n<p><code>0 kB<br \/>\nMlocked: <\/code><\/p>\n<p><code>0 kB<br \/>\nSwapTotal: <\/code><\/p>\n<p><code>2097152 kB<br \/>\nSwapFree: <\/code><\/p>\n<p><code>2097152 kB<br \/>\nDirty: <\/code><\/p>\n<p><code>0 kB<br \/>\nWriteback: <\/code><\/p>\n<p><code>0 kB<br \/>\nAnonPages:<\/code><\/p>\n<p><code><\/code><code><\/code><code>37208 kB<br \/>\nMapped: <\/code><\/p>\n<p><code>63220 kB<br \/>\nShmem: <\/code><\/p>\n<p><code>2236 kB<br \/>\nKReclaimable: <\/code><\/p>\n<p><code>21148 kB<br \/>\nSlab: <\/code><\/p>\n<p><code>67344 kB<br \/>\nSReclaimable: <\/code><\/p>\n<p><code>21148 kB<br \/>\nSUnreclaim: <\/code><\/p>\n<p><code>46196 kB<br \/>\nKernelStack: <\/code><\/p>\n<p><code>3184 kB<br \/>\nPageTables: <\/code><\/p>\n<p><code>1216 kB<br \/>\nNFS_Unstable: <\/code><\/p>\n<p><code>0 kB<br \/>\nBounce: <\/code><\/p>\n<p><code>0 kB<br \/>\nWritebackTmp: <\/code><\/p>\n<p><code>0 kB<br \/>\nCommitLimit: <\/code><\/p>\n<p><code>6142516 kB<br \/>\nCommitted_AS: <\/code><\/p>\n<p><code>390148 kB<br \/>\nVmallocTotal: <\/code><\/p>\n<p><code>34359738367 kB<br \/>\nVmallocUsed: <\/code><\/p>\n<p><code>23376 kB<br \/>\nVmallocChunk: <\/code><\/p>\n<p><code>0 kB<br \/>\nPercpu:<\/code><\/p>\n<p><code><\/code><code>4352 kB<br \/>\nAnonHugePages: <\/code><\/p>\n<p><code>14336 kB<br \/>\nShmemHugePages: <\/code><\/p>\n<p><code>0 kB<br \/>\nShmemPmdMapped: <\/code><\/p>\n<p><code>0 kB<br \/>\nFileHugePages: <\/code><\/p>\n<p><code>0 kB<br \/>\nFilePmdMapped: <\/code><\/p>\n<p><code>0 kB<br \/>\nHugePages_Total: <\/code><\/p>\n<p><code>0<br \/>\nHugePages_Free: <\/code><\/p>\n<p><code>0<br \/>\nHugePages_Rsvd: <\/code><\/p>\n<p><code>0<br \/>\nHugePages_Surp: <\/code><\/p>\n<p><code>0<br \/>\nHugepagesize: <\/code><\/p>\n<p><code>2048 kB<br \/>\nHugetlb: <\/code><\/p>\n<p><code>0 kB<br \/>\nDirectMap4k: <\/code><\/p>\n<p><code>19456 kB<br \/>\nDirectMap2M: <\/code><\/p>\n<p><code>4128768 kB<br \/>\nDirectMap1G: <\/code><\/p>\n<p><code>13631488 kB<\/code><\/p>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone wp-image-1460\" src=\"https:\/\/www.servergigabit.com\/blog\/wp-content\/uploads\/2023\/03\/cat_proc_meminfo-243x300.jpg\" alt=\"top command\" width=\"341\" height=\"421\" srcset=\"https:\/\/www.servergigabit.com\/blog\/wp-content\/uploads\/2023\/03\/cat_proc_meminfo-243x300.jpg 243w, https:\/\/www.servergigabit.com\/blog\/wp-content\/uploads\/2023\/03\/cat_proc_meminfo-370x458.jpg 370w, https:\/\/www.servergigabit.com\/blog\/wp-content\/uploads\/2023\/03\/cat_proc_meminfo-390x482.jpg 390w, https:\/\/www.servergigabit.com\/blog\/wp-content\/uploads\/2023\/03\/cat_proc_meminfo.jpg 427w\" sizes=\"(max-width: 341px) 100vw, 341px\" \/><\/p>\n<p>As you can notice, the \/proc\/meminfo lists all the processes, buffers, and shared memory usage in\u00a0kilobytes. The\u00a0MemTotal\u00a0is the total memory of your system. The\u00a0MemFree, on the other hand, lists free memory. You&#8217;ll also see\u00a0MemAvailiable, which is similar to\u00a0MemFree. It lets you know how much memory is available for new processes.<\/p>\n<p>The other values are as below:<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>Buffers:\u00a0The amount of memory used by buffers.<\/li>\n<li>Cached:\u00a0The amount of memory used as cache memory.<\/li>\n<li>SwapTotal: The total amount of swap memory.<\/li>\n<li>SwapFree:\u00a0The available swap memory.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>If you want to know more about \/proc\/meminfo values, read this:\u00a0Explanation\u00a0of \/proc\/meminfo values.<\/p>\n<p>You can also use the following commands to show fewer values.<\/p>\n<p><code>less \/proc\/meminfo<\/code><code><\/code><code><\/code><\/p>\n<p><code>more \/proc\/meminfo<\/code><\/p>\n<h2 id=\"table-of-contents-3\"><strong>Free Command to see free and used memory in Linux<\/strong><\/h2>\n<p>The\u00a0free\u00a0Command is a neat way to learn about your system&#8217;s physical and swap memory status. It lists the total, used, and free memory usage, alongside shared and buff\/cache values. Lastly, it also lists available memory.<\/p>\n<p>To run the Command, type the following in the terminal.<\/p>\n<p><code>free<\/code><\/p>\n<p>By default, it&#8217;ll show the values in Kilobytes. If you need the output in Megabytes(MB), use the -m flag.<\/p>\n<p><code>free -m<\/code><\/p>\n<p>The output is:<\/p>\n<p><code>total used free shared buff\/cache available<br \/>\nMem: 7901 303 7452 2 145 7395<br \/>\nSwap: 2048 0 2048<\/code><\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-1461\" src=\"https:\/\/www.servergigabit.com\/blog\/wp-content\/uploads\/2023\/03\/free-command-300x115.jpg\" alt=\"free command\" width=\"663\" height=\"254\" srcset=\"https:\/\/www.servergigabit.com\/blog\/wp-content\/uploads\/2023\/03\/free-command-300x115.jpg 300w, https:\/\/www.servergigabit.com\/blog\/wp-content\/uploads\/2023\/03\/free-command-370x142.jpg 370w, https:\/\/www.servergigabit.com\/blog\/wp-content\/uploads\/2023\/03\/free-command-390x150.jpg 390w, https:\/\/www.servergigabit.com\/blog\/wp-content\/uploads\/2023\/03\/free-command.jpg 673w\" sizes=\"(max-width: 663px) 100vw, 663px\" \/><\/p>\n<p>Understanding the free Command displays information is accessible. Under the entire tab, you&#8217;ll see the Mem and Swap values. Similarly, it also lists the used and free values. Let&#8217;s list them below.<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><strong>Total:\u00a0<\/strong>Shows the system&#8217;s total RAM. In our case, it is 7901 MB.<\/li>\n<li><strong>Used:<\/strong>\u00a0Shows the system&#8217;s used RAM. In our case, it is 303 MB.<\/li>\n<li><strong>Free:<\/strong>\u00a0Shows the system&#8217;s free memory. In our case, it is 7452 MB.<\/li>\n<li><strong>Shared:\u00a0<\/strong>Here, you&#8217;ll find the memory usage by the tmpfs file system.<\/li>\n<li><strong>Buff\/cache:\u00a0<\/strong>It lists the memory used by the buffer and cache.<\/li>\n<li><strong>Available:<\/strong>\u00a0System&#8217;s available memory for new apps. In other words, any app can use the available memory without relying on swap memory.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>The Memory column list all the above information. As for Swap, you only get Total, Used, and Free values.<\/p>\n<p>Lastly, if you want to display it in line, then you need to use the following Command.<\/p>\n<p><code>free -t -m<\/code><\/p>\n<h2 id=\"table-of-contents-4\"><strong>vmstat Command to Report Virtual Memory Statistics in Linux system<\/strong><\/h2>\n<p>If you only want to learn about virtual memory statistics, use\u00a0the vmstat\u00a0Command. The command syntax is:<\/p>\n<p><code>vmstat<\/code><\/p>\n<p>It reports virtual memory statistics, including processes, paging, block device, memory, traps, disks, and CPU.<\/p>\n<p>However, its output is not easy to read. You&#8217;ll get the following output if you type vmstat in the terminal.<\/p>\n<p><code>#output<br \/>\nprocs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----<br \/>\n<\/code><\/p>\n<p><code>r b swpd free buff cache si so bi bo in cs us sy id wa st<br \/>\n<\/code><\/p>\n<p><code>0 0 0 7631484 5912 142568 0 0 1 0 1 19 0 0 100 0 0<\/code><\/p>\n<p><img decoding=\"async\" class=\"alignnone wp-image-1462\" src=\"https:\/\/www.servergigabit.com\/blog\/wp-content\/uploads\/2023\/03\/vmstat-300x141.png\" alt=\"vmstat command\" width=\"566\" height=\"266\" srcset=\"https:\/\/www.servergigabit.com\/blog\/wp-content\/uploads\/2023\/03\/vmstat-300x141.png 300w, https:\/\/www.servergigabit.com\/blog\/wp-content\/uploads\/2023\/03\/vmstat-370x174.png 370w, https:\/\/www.servergigabit.com\/blog\/wp-content\/uploads\/2023\/03\/vmstat-390x183.png 390w, https:\/\/www.servergigabit.com\/blog\/wp-content\/uploads\/2023\/03\/vmstat.png 583w\" sizes=\"(max-width: 566px) 100vw, 566px\" \/><\/p>\n<p>As you can see, the output is not clear. To circumvent it, you can use the -s switch flag. It forces the\u00a0<strong>vmstat\u00a0<\/strong>Command to show values in a single column. This makes it easy to read.<\/p>\n<p><code>vmstat -s<\/code><\/p>\n<p><code>#output<br \/>\n<\/code><\/p>\n<p><code>8090732 K total memory<br \/>\n<\/code><\/p>\n<p><code>310728 K used memory<br \/>\n<\/code><\/p>\n<p><code>22340 K active memory<br \/>\n<\/code><\/p>\n<p><code>144956 K inactive memory<br \/>\n<\/code><\/p>\n<p><code>7631484 K free memory<br \/>\n<\/code><\/p>\n<p><code>5912 K buffer memory<\/code><\/p>\n<p><code>142608 K swap cache<br \/>\n<\/code><\/p>\n<p><code>2097152 K total swap<br \/>\n<\/code><\/p>\n<p><code>0 K used swap<br \/>\n<\/code><\/p>\n<p><code>2097152 K free swap<br \/>\n<\/code><\/p>\n<p><code>299 non-nice user cpu ticks<br \/>\n<\/code><\/p>\n<p><code>0 nice user cpu ticks<br \/>\n<\/code><\/p>\n<p><code>581 system cpu ticks<br \/>\n<\/code><\/p>\n<p><code>8080176 idle cpu ticks<br \/>\n<\/code><\/p>\n<p><code>51 IO-wait cpu ticks<br \/>\n<\/code><\/p>\n<p><code>0 IRQ cpu ticks<br \/>\n<\/code><\/p>\n<p><code>24 softirq cpu ticks<br \/>\n<\/code><\/p>\n<p><code>0 stolen cpu ticks<br \/>\n<\/code><\/p>\n<p><code>84626 pages paged in<br \/>\n<\/code><\/p>\n<p><code>972 pages paged out<br \/>\n<\/code><\/p>\n<p><code>0 pages swapped in<br \/>\n<\/code><\/p>\n<p><code>0 pages swapped out<br \/>\n<\/code><\/p>\n<p><code>42773 interrupts<br \/>\n<\/code><\/p>\n<p><code>1555675 CPU context switches<br \/>\n<\/code><\/p>\n<p><code>1677583195 boot time<br \/>\n<\/code><\/p>\n<p><code>334 forks<\/code><\/p>\n<p>With\u00a0vmstat, you can check memory usage on Linux and learn about different system summaries. That&#8217;s why\u00a0vmstat\u00a0is more of a system monitor tool that offers more than just checking RAM usage.<\/p>\n<p>Some of its unique options include:<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>&#8211; a Active: It lets you discover the system&#8217;s active and inactive memory.<\/li>\n<li>&#8211; f : It lists the number of times the system has been forked since boot.<\/li>\n<li>-d : Use it to show disk space and other disk statistics<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>In short, you can use\u00a0vmstat\u00a0to learn about procs, swap space, operating system&#8217;s IO, interrupts, and context switches. Additionally, you can learn about CPU usage, including time running kernel code, non-kernel code, idle time spent, and much more.<\/p>\n<h2 id=\"table-of-contents-5\"><strong>Top Command to Check Memory Use<\/strong><\/h2>\n<p>The\u00a0top\u00a0Command is another useful command to check memory usage in the Linux operating system. It provides a detailed system summary that offers access to memory and CPU usage.<\/p>\n<p>The syntax of the top Command is as below.<\/p>\n<pre><code>top<\/code><\/pre>\n<p>When you run the\u00a0<strong>top\u00a0<\/strong>Command, it offers access to the following information:<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>memory\/ swap system processes<\/li>\n<li>number of users logged in<\/li>\n<li>Average load on the system<\/li>\n<li>System&#8217;s uptime<\/li>\n<li>Number of tasks running processes<\/li>\n<li>The number of CPUs utilization<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>And the output for the top Command to check memory usage is as below:<code><\/code><\/p>\n<p><code>top - 19:47:24 up 27 min, 0 users, load average: 0.00, 0.00, 0.00<br \/>\n<\/code><\/p>\n<p><code>Tasks: 6 total, 1 running, 5 sleeping, 0 stopped, 0 zombie<br \/>\n<\/code><\/p>\n<p><code>%Cpu(s): 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st<br \/>\n<\/code><\/p>\n<p><code>MiB Mem : 7901.1 total, 7459.8 free, 296.8 used, 144.5 buff\/cache<br \/>\n<\/code><\/p>\n<p><code>MiB Swap: 2048.0 total, 2048.0 free, 0.0 used. 7402.4 avail Mem<br \/>\n<\/code><\/p>\n<p><code>PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND<br \/>\n<\/code><\/p>\n<p><code>1 root 20 0 2296 1608 1516 S 0.0 0.0 0:00.00 init(Ubuntu)<br \/>\n<\/code><\/p>\n<p><code>4 root 20 0 2296 4 0 S 0.0 0.0 0:00.00 init<br \/>\n<\/code><\/p>\n<p><code>7 root 20 0 2300 100 0 S 0.0 0.0 0:00.00 SessionLeader<br \/>\n<\/code><\/p>\n<p><code>8 root 20 0 2316 104 0 S 0.0 0.0 0:00.00 Relay(9)<br \/>\n<\/code><\/p>\n<p><code>9 nitt 20 0 6080 5044 3324 S 0.0 0.1 0:00.02 bash<br \/>\n<\/code><\/p>\n<p><code>22 nitt 20 0 7792 3616 3032 R 0.0 0.0 0:00.01 top<\/code><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1463\" src=\"https:\/\/www.servergigabit.com\/blog\/wp-content\/uploads\/2023\/03\/top-command-linux-300x133.png\" alt=\"top command\" width=\"622\" height=\"276\" srcset=\"https:\/\/www.servergigabit.com\/blog\/wp-content\/uploads\/2023\/03\/top-command-linux-300x133.png 300w, https:\/\/www.servergigabit.com\/blog\/wp-content\/uploads\/2023\/03\/top-command-linux-1024x453.png 1024w, https:\/\/www.servergigabit.com\/blog\/wp-content\/uploads\/2023\/03\/top-command-linux-768x340.png 768w, https:\/\/www.servergigabit.com\/blog\/wp-content\/uploads\/2023\/03\/top-command-linux-1536x680.png 1536w, https:\/\/www.servergigabit.com\/blog\/wp-content\/uploads\/2023\/03\/top-command-linux-370x164.png 370w, https:\/\/www.servergigabit.com\/blog\/wp-content\/uploads\/2023\/03\/top-command-linux-800x354.png 800w, https:\/\/www.servergigabit.com\/blog\/wp-content\/uploads\/2023\/03\/top-command-linux-390x173.png 390w, https:\/\/www.servergigabit.com\/blog\/wp-content\/uploads\/2023\/03\/top-command-linux.png 1568w\" sizes=\"(max-width: 622px) 100vw, 622px\" \/><\/p>\n<p>The\u00a0top\u00a0Command offers customizability through user-specified criteria. This makes it interactive, and it also updates periodically. So, if you need to check memory usage in real-time, you can use the\u00a0top\u00a0Command.<\/p>\n<p>It starts with CPU information, followed by memory usage. At the bottom, it has a processes tab that lists processes individually. Furthermore, each process has its details listed, including:<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li>PID (Process ID),<\/li>\n<li>User,<\/li>\n<li>PR (Process Priority),<\/li>\n<li>NI (Nice Value),<\/li>\n<li>VIRT (virtual memory used by process),<\/li>\n<li>RES (Physical RAM usage by that particular process),<\/li>\n<li>SHR (Shared RAM usage by that particular process),<\/li>\n<li>%CPU (shows the CPU usage for the process),<\/li>\n<li>$MEM (shows the memory usage for the process),<\/li>\n<li>TIME+ (CPU Time listed in hundredths of a second),<\/li>\n<li>COMMAND (list the command name that started the process<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2 id=\"table-of-contents-6\"><strong>htop Command to Find the Memory Load of Each Process<\/strong><\/h2>\n<p>htop\u00a0Command is an evolution of the top Command. It offers better controls and a user-friendly environment for the users.<\/p>\n<p>The syntax of the Command is:<\/p>\n<p><code>htop<\/code><\/p>\n<p>As soon as you input it, the following visual representation will pop up:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1464\" src=\"https:\/\/www.servergigabit.com\/blog\/wp-content\/uploads\/2023\/03\/htop-command-300x169.jpg\" alt=\"htop command - interactive and user-friendly \" width=\"487\" height=\"274\" srcset=\"https:\/\/www.servergigabit.com\/blog\/wp-content\/uploads\/2023\/03\/htop-command-300x169.jpg 300w, https:\/\/www.servergigabit.com\/blog\/wp-content\/uploads\/2023\/03\/htop-command-370x208.jpg 370w, https:\/\/www.servergigabit.com\/blog\/wp-content\/uploads\/2023\/03\/htop-command-390x219.jpg 390w, https:\/\/www.servergigabit.com\/blog\/wp-content\/uploads\/2023\/03\/htop-command.jpg 686w\" sizes=\"(max-width: 487px) 100vw, 487px\" \/><\/p>\n<p>Like the\u00a0<strong>top\u00a0<\/strong>Command, the\u00a0<strong>htop<\/strong>\u00a0command updates in real-time. It has three main segments. The first segment visually provides valuable data, including installed RAM, amount of memory left, number of tasks running, average load, and uptime.<\/p>\n<p>In the 2nd segment, you&#8217;ll notice all process-related data. Unlike the\u00a0<strong>top<\/strong>\u00a0Command, you can perform actions on each process here.<\/p>\n<p>The bottom(3rd section) is where you&#8217;ll find all the available options, such as Setup(F2), Search(F3), F5(Tree), and so on.<\/p>\n<p>It doesn&#8217;t come pre-installed in many systems as it is newer than the top Command. To install it, run the following Command:<\/p>\n<p><code>sudo apt install htop<br \/>\n<\/code><\/p>\n<p><code>sudo apt-get install htop<\/code><\/p>\n<h2 id=\"table-of-contents-7\"><strong>Bonus: GNOME Desktop: GUI tool to see memory usage<\/strong><\/h2>\n<p>Linux systems are created to work with a command line interface. However, if you dislike working with the command line output, you can always use a GUI tool such as GNOME desktop to check memory usage.<\/p>\n<p>To do so, you need to run the following prompt in the command line:<\/p>\n<p><code>gnome-system-monitor<\/code><\/p>\n<p>If the Command doesn&#8217;t work, you must install it.<\/p>\n<p><code>sudo apt install gnome-system-monitor<\/code><\/p>\n<p>You can access it by going to system&gt; Administrator &gt; System Monitor.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-1465\" src=\"https:\/\/www.servergigabit.com\/blog\/wp-content\/uploads\/2023\/03\/gnome-system-monitor-300x288.png\" alt=\"gnome system monitor\" width=\"456\" height=\"438\" srcset=\"https:\/\/www.servergigabit.com\/blog\/wp-content\/uploads\/2023\/03\/gnome-system-monitor-300x288.png 300w, https:\/\/www.servergigabit.com\/blog\/wp-content\/uploads\/2023\/03\/gnome-system-monitor-370x355.png 370w, https:\/\/www.servergigabit.com\/blog\/wp-content\/uploads\/2023\/03\/gnome-system-monitor-390x374.png 390w, https:\/\/www.servergigabit.com\/blog\/wp-content\/uploads\/2023\/03\/gnome-system-monitor.png 735w\" sizes=\"(max-width: 456px) 100vw, 456px\" \/><\/p>\n<p>As you can see that the window has three tabs:\u00a0Processes tab, Resources tab, and File Systems\u00a0tab. You can switch between each tab to learn about them.<\/p>\n<h2 id=\"table-of-contents-8\"><strong>Conclusion<\/strong><\/h2>\n<p>This leads us to the end of our five commands to check memory in the Linux system. We covered five commands: cat, htop, vmstat, top, and free Command. You can use any of them to see the Linux system&#8217;s memory usage. However, learning how to interpret these commands&#8217; output is critical. It enables you to troubleshoot memory issues, especially if you&#8217;re a developer or a sysadmin. If you need more tips and best practices, you can visit <a href=\"https:\/\/www.servergigabit.com\/blog\/tips-sharing\">this guide<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; Commands to Check Memory Usage in Linux are essential for understanding how much memory is available on your system. Have you ever wondered how much memory is available on your Linux system? If you do, you&#8217;re not alone. Linux\u2019s memory usage is generally lower compared to other operating systems. However, it doesn\u2019t always offer an intuitive way to check&hellip;<\/p>\n","protected":false},"author":1,"featured_media":976,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[566],"tags":[],"class_list":["post-845","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.servergigabit.com\/blog\/wp-json\/wp\/v2\/posts\/845","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.servergigabit.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.servergigabit.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.servergigabit.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.servergigabit.com\/blog\/wp-json\/wp\/v2\/comments?post=845"}],"version-history":[{"count":8,"href":"https:\/\/www.servergigabit.com\/blog\/wp-json\/wp\/v2\/posts\/845\/revisions"}],"predecessor-version":[{"id":1468,"href":"https:\/\/www.servergigabit.com\/blog\/wp-json\/wp\/v2\/posts\/845\/revisions\/1468"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.servergigabit.com\/blog\/wp-json\/wp\/v2\/media\/976"}],"wp:attachment":[{"href":"https:\/\/www.servergigabit.com\/blog\/wp-json\/wp\/v2\/media?parent=845"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.servergigabit.com\/blog\/wp-json\/wp\/v2\/categories?post=845"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.servergigabit.com\/blog\/wp-json\/wp\/v2\/tags?post=845"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}