<?xml version="1.0" encoding="utf-8" standalone="yes"?><feed xmlns="http://www.w3.org/2005/Atom" xml:base="https://foundata.com/" xml:lang="en"><title>Free on foundata</title><id>https://foundata.com/en/tags/free/feed-atom.xml</id><link rel="self" type="application/atom+xml" hreflang="en" href="https://foundata.com/en/tags/free/feed-atom.xml" title="atom"/><link rel="alternate" type="text/html" hreflang="en" href="https://foundata.com/en/tags/free/" title="html"/><link rel="alternate" type="application/rss+xml" hreflang="en" href="https://foundata.com/en/tags/free/feed-rss.xml" title="rss"/><link rel="alternate" type="application/atom+xml" hreflang="de" href="https://foundata.com/de/tags/free/feed-atom.xml" title="atom, Deutsch"/><link rel="alternate" type="text/html" hreflang="de" href="https://foundata.com/de/tags/free/feed-atom.xml" title="html, Deutsch"/><link rel="alternate" type="application/rss+xml" hreflang="de" href="https://foundata.com/de/tags/free/feed-atom.xml" title="rss, Deutsch"/><updated>2025-06-23T18:10:00Z</updated><author><name>foundata GmbH</name><email>webmaster@foundata.com</email><uri>https://foundata.com/</uri></author><rights>© 2023-2026, foundata GmbH (https://foundata.com)</rights><icon>https://foundata.com/images/feed-icon.67ff83c698af1511552374e80cf5f6ff26d497ef21f04186cf058859d535ca75.svg</icon><logo>https://foundata.com/images/feed-logo.9138f24a120dabc7e3d34003662131cc9c7f2ff153ec39d2f6dea3a48c35b4bf.svg</logo><entry><title type="html">System insights with command-line tools: free and vmstat</title><id>tag:foundata.com,2025-06-23:/en/blog/2025/system-insights-command-line-free-vmstat/</id><published>2025-06-23T18:10:00Z</published><updated>2025-06-23T18:10:00Z</updated><link href="https://foundata.com/en/blog/2025/system-insights-command-line-free-vmstat/?utm_source=feed-atom" rel="alternate" type="text/html"/><link href="https://foundata.com/de/blog/2025/systemeinblicke-kommandozeile-free-vmstat/?utm_source=feed-atom" rel="alternate" type="text/html" hreflang="de"/><link href="https://foundata.com/en/blog/2025/fsfe-reuse-open-source-licensing-tips-tricks-spdx-sbom/?utm_source=feed-atom" rel="related" type="text/html" title="Making sense of software licensing with FSFE REUSE: A guide for open source developers, tips and tricks."/><link href="https://foundata.com/en/blog/2024/system-insights-command-line-lslogins-lsmod/?utm_source=feed-atom" rel="related" type="text/html" title="System insights with command-line tools: lslogins and lsmod"/><link href="https://foundata.com/en/blog/2024/system-insights-command-line-lsof-lsblk/?utm_source=feed-atom" rel="related" type="text/html" title="System insights with command-line tools: lsof and lsblk"/><link href="https://foundata.com/en/blog/2024/system-insights-command-line-lscpu-lsusb/?utm_source=feed-atom" rel="related" type="text/html" title="System insights with command-line tools: lscpu and lsusb"/><link href="https://foundata.com/en/blog/2024/system-insights-command-line-dmidecode-lspci/?utm_source=feed-atom" rel="related" type="text/html" title="System insights with command-line tools: dmidecode and lspci"/><author><name>Andreas Haerter</name><uri>https://andreashaerter.com/</uri></author><summary type="html">An article introducing the command line tools `free` and `vmstat`.</summary><content type="html" xml:base="https://foundata.com/"><![CDATA[<p><em>Note: This article was originally released <a href="https://fedoramagazine.org/system-insights-with-command-line-tools-free-and-vmstat/" target="_blank" rel="noreferrer noopener">in the Fedora Magazine</a>.</em></p>
<p>In this fifth article of the &ldquo;<a href="https://foundata.com/en/blog/2024/system-insights-command-line-lscpu-lsusb/">System</a> <a href="https://foundata.com/en/blog/2024/system-insights-command-line-dmidecode-lspci/">insights</a> <a href="https://foundata.com/en/blog/2024/system-insights-command-line-lsof-lsblk/">with</a> <a href="https://foundata.com/en/blog/2024/system-insights-command-line-lslogins-lsmod/">command-line tools</a>&rdquo; series we explore <code>free</code> and <code>vmstat</code>, two small utilities that reveal a surprising amount about your Linux system&rsquo;s health. <code>free</code> gives you an instant snapshot of how RAM and <a href="https://en.wikipedia.org/wiki/Memory_swapping" target="_blank" rel="noreferrer noopener">swap</a> are being used. <code>vmstat</code> (the virtual memory statistics reporter) reports a real-time view of memory, CPU, and I/O activity.</p>
<p>By the end of this article you will be able to translate buffers and cache into &ldquo;breathing room&rdquo;, read the mysterious available column with confidence, and spot memory leaks or I/O saturation.</p>
<h2 id="a-quick-tour-of-free" class="scroll-mt-20 md:scroll-mt-24 wrap-break-word group/heading "><a href="#a-quick-tour-of-free" class="group-hover/heading:after:content-['#'] group-hover/heading:after:ml-1.5 group-hover/heading:after:text-content-400" id="a-quick-tour-of-free">A quick tour of <code>free</code></a></h2><h3 id="basic-usage" class="scroll-mt-20 md:scroll-mt-24 wrap-break-word group/heading "><a href="#basic-usage" class="group-hover/heading:after:content-['#'] group-hover/heading:after:ml-1.5 group-hover/heading:after:text-content-400" id="basic-usage">Basic usage</a></h3><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">$ free -h
</span></span><span class="line"><span class="cl">       total    used    free   shared  buff/cache  available
</span></span><span class="line"><span class="cl">Mem:    23Gi    14Gi   575Mi    3,3Gi        12Gi      8,8Gi
</span></span><span class="line"><span class="cl">Swap:  8,0Gi   6,6Gi   1,4Gi
</span></span></code></pre></div><p><code>free</code> parses <code>/proc/meminfo</code> and prints totals for physical memory and swap, along with kernel buffers and cache. Use <code>-h</code> for human-readable units, <code>-s 1</code> to refresh every second, and <code>-c N</code> to stop after <code>N</code> samples which is handy to get a trend when doing something in parallel. For example, <code>free -s 60 -c 1440</code> gives a 24-hour CSV-friendly record without installing extra monitoring daemons.</p>
<p><strong>Free memory</strong> refers to RAM that is entirely unoccupied. It isn&rsquo;t being used by any process or for caching. On server systems, I tend to view this as wasted since unused memory isn&rsquo;t contributing to performance. Ideally, after a system has been running for some time, this number should remain low.</p>
<p><strong>Available memory</strong>, on the other hand, represents an estimate of how much memory can be used by new or running processes without resorting to swap. It includes free memory plus parts of the cache and buffers that the system can reclaim quickly if needed.</p>
<p>In essence, the distinction in Linux lies here: <em>free</em> memory is idle and unused, while <em>available</em> memory includes both truly free space and memory that can be readily freed up to keep the system responsive without swapping. <strong>It is not a problem to have a low free memory, available memory is usually what to be concerned about.</strong></p>
<p>A healthy system might even show <code>used</code> ≈ <code>total</code> yet <code>available</code> remains large; that mostly reflects cache at work. Your Linux kernel will automatically drop clean cache pages whenever an application needs the space, so cached memory is not wasted. Think of it as a working set that just hasn&rsquo;t been reassigned yet.</p>
<h3 id="spotting-problems-with-free" class="scroll-mt-20 md:scroll-mt-24 wrap-break-word group/heading "><a href="#spotting-problems-with-free" class="group-hover/heading:after:content-['#'] group-hover/heading:after:ml-1.5 group-hover/heading:after:text-content-400" id="spotting-problems-with-free">Spotting problems with <code>free</code></a></h3><ul>
<li><strong>Rapidly shrinking <code>available</code> combined with rising <code>swap used</code></strong> indicates real memory pressure.</li>
<li><strong>Large swap-in/out spikes</strong> point to thrashing workloads or runaway memory consumers.</li>
</ul>
<h2 id="vmstat--report-virtual-memory-statistics" class="scroll-mt-20 md:scroll-mt-24 wrap-break-word group/heading "><a href="#vmstat--report-virtual-memory-statistics" class="group-hover/heading:after:content-['#'] group-hover/heading:after:ml-1.5 group-hover/heading:after:text-content-400" id="vmstat--report-virtual-memory-statistics"><code>vmstat</code> – Report virtual memory statistics</a></h2><p><code>vmstat</code> (virtual memory statistics) displays processes, memory, paging, block-I/O, interrupts, context switches, and CPU utilization in a single line. Run it with an interval and count to watch trends (output shown below has been split into three sections for better readability):</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">$ vmstat <span class="m">1</span> <span class="m">3</span>
</span></span><span class="line"><span class="cl">procs -----------memory----------
</span></span><span class="line"><span class="cl"> r  b   swpd   free   buff  cache
</span></span><span class="line"><span class="cl"> <span class="m">2</span>  <span class="m">0</span> <span class="m">7102404</span> <span class="m">1392528</span>     <span class="m">36</span> <span class="m">12335148</span>
</span></span><span class="line"><span class="cl"> <span class="m">0</span>  <span class="m">0</span> <span class="m">7102404</span> <span class="m">1392560</span>     <span class="m">36</span> <span class="m">12335188</span>
</span></span><span class="line"><span class="cl"> <span class="m">0</span>  <span class="m">0</span> <span class="m">7102404</span> <span class="m">1373640</span>     <span class="m">36</span> <span class="m">12349928</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> ---swap-- -----io----
</span></span><span class="line"><span class="cl">  si   so    bi    bo
</span></span><span class="line"><span class="cl">   <span class="m">8</span>   <span class="m">21</span>   <span class="m">130</span>   <span class="m">724</span>
</span></span><span class="line"><span class="cl">   <span class="m">0</span>    <span class="m">0</span>     <span class="m">0</span>     <span class="m">0</span>
</span></span><span class="line"><span class="cl">   <span class="m">0</span>    <span class="m">0</span>     <span class="m">8</span>    <span class="m">48</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> -system-- -------cpu-------
</span></span><span class="line"><span class="cl"> in     cs us sy id wa st gu
</span></span><span class="line"><span class="cl"> <span class="m">2851</span>   <span class="m">19</span> <span class="m">15</span>  <span class="m">7</span> <span class="m">77</span>  <span class="m">0</span>  <span class="m">0</span>  <span class="m">0</span>
</span></span><span class="line"><span class="cl"> <span class="m">5779</span> <span class="m">7246</span> <span class="m">14</span> <span class="m">10</span> <span class="m">77</span>  <span class="m">0</span>  <span class="m">0</span>  <span class="m">0</span>
</span></span><span class="line"><span class="cl"> <span class="m">5141</span> <span class="m">6525</span> <span class="m">12</span>  <span class="m">9</span> <span class="m">79</span>  <span class="m">0</span>  <span class="m">0</span>  <span class="m">0</span>
</span></span></code></pre></div><h3 id="anatomy-of-the-output" class="scroll-mt-20 md:scroll-mt-24 wrap-break-word group/heading "><a href="#anatomy-of-the-output" class="group-hover/heading:after:content-['#'] group-hover/heading:after:ml-1.5 group-hover/heading:after:text-content-400" id="anatomy-of-the-output">Anatomy of the output</a></h3><p>From the <code>vmstat(8)</code> manpage:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">Procs
</span></span><span class="line"><span class="cl">    r: The number of runnable processes (running or waiting
</span></span><span class="line"><span class="cl">       for run time).
</span></span><span class="line"><span class="cl">    b: The number of processes blocked waiting for I/O to
</span></span><span class="line"><span class="cl">       complete.
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">Memory
</span></span><span class="line"><span class="cl">    These are affected by the --unit option.
</span></span><span class="line"><span class="cl">    swpd: the amount of swap memory used.
</span></span><span class="line"><span class="cl">    free: the amount of idle memory.
</span></span><span class="line"><span class="cl">    buff: the amount of memory used as buffers.
</span></span><span class="line"><span class="cl">    cache: the amount of memory used as cache.
</span></span><span class="line"><span class="cl">    inact: the amount of inactive memory.  (-a option)
</span></span><span class="line"><span class="cl">    active: the amount of active memory.  (-a option)
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">Swap
</span></span><span class="line"><span class="cl">    These are affected by the --unit option.
</span></span><span class="line"><span class="cl">    si: Amount of memory swapped in from disk (/s).
</span></span><span class="line"><span class="cl">    so: Amount of memory swapped to disk (/s).
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">IO
</span></span><span class="line"><span class="cl">    bi: Kibibyte received from a block device (KiB/s).
</span></span><span class="line"><span class="cl">    bo: Kibibyte sent to a block device (KiB/s).
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">System
</span></span><span class="line"><span class="cl">    in: The number of interrupts per second, including
</span></span><span class="line"><span class="cl">        the clock.
</span></span><span class="line"><span class="cl">    cs: The number of context switches per second.
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">CPU
</span></span><span class="line"><span class="cl">    These are percentages of total CPU time.
</span></span><span class="line"><span class="cl">    us: Time spent running non-kernel code.  (user time,
</span></span><span class="line"><span class="cl">        including nice time)
</span></span><span class="line"><span class="cl">    sy: Time spent running kernel code.  (system time)
</span></span><span class="line"><span class="cl">    id: Time spent idle.  Prior to Linux 2.5.41, this
</span></span><span class="line"><span class="cl">        includes IO-wait time.
</span></span><span class="line"><span class="cl">    wa: Time spent waiting for IO.  Prior to Linux 2.5.41,
</span></span><span class="line"><span class="cl">        included in idle.
</span></span><span class="line"><span class="cl">    st: Time stolen from a virtual machine.  Prior to
</span></span><span class="line"><span class="cl">        Linux 2.6.11, unknown.
</span></span><span class="line"><span class="cl">    gu: Time spent running KVM guest code (guest time,
</span></span><span class="line"><span class="cl">        including guest nice).
</span></span></code></pre></div><h3 id="practical-diagnostics" class="scroll-mt-20 md:scroll-mt-24 wrap-break-word group/heading "><a href="#practical-diagnostics" class="group-hover/heading:after:content-['#'] group-hover/heading:after:ml-1.5 group-hover/heading:after:text-content-400" id="practical-diagnostics">Practical diagnostics</a></h3><table>
  <thead>
      <tr>
          <th>Section</th>
          <th>Key Fields</th>
          <th>What to watch</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Procs</td>
          <td><code>r</code> (run-queue),<br><code>b</code> (blocked)</td>
          <td><code>r</code> &gt; CPU cores = contention</td>
      </tr>
      <tr>
          <td>Memory</td>
          <td><code>swpd</code>, <code>free</code>, <code>buff</code>, <code>cache</code></td>
          <td>Rising <code>swpd</code> with falling <code>free</code> = pressure</td>
      </tr>
      <tr>
          <td>Swap</td>
          <td><code>si</code>, <code>so</code></td>
          <td>Non-zero so means the kernel is swapping out</td>
      </tr>
      <tr>
          <td>IO</td>
          <td><code>bi</code>, <code>bo</code></td>
          <td>High bo + high wa hints at write-heavy workloads</td>
      </tr>
      <tr>
          <td>System</td>
          <td><code>in</code>, <code>cs</code></td>
          <td>Sudden spikes may indicate interrupt storms</td>
      </tr>
      <tr>
          <td>CPU</td>
          <td><code>us</code>, <code>sy</code>, <code>id</code>, <code>wa</code>, <code>st</code></td>
          <td>High wa (I/O wait) = storage bottleneck</td>
      </tr>
  </tbody>
</table>
<h4 id="catching-a-memory-leak" class="scroll-mt-20 md:scroll-mt-24 wrap-break-word group/heading "><a href="#catching-a-memory-leak" class="group-hover/heading:after:content-['#'] group-hover/heading:after:ml-1.5 group-hover/heading:after:text-content-400" id="catching-a-memory-leak">Catching a memory leak</a></h4><p>Run <code>vmstat 500</code> in one terminal while your suspect application runs in another. If <code>free</code> keeps falling and <code>si</code>/<code>so</code> climb over successive samples, physical RAM is being exhausted and the kernel starts swapping, which is classic leak behavior.</p>
<h4 id="finding-io-saturation" class="scroll-mt-20 md:scroll-mt-24 wrap-break-word group/heading "><a href="#finding-io-saturation" class="group-hover/heading:after:content-['#'] group-hover/heading:after:ml-1.5 group-hover/heading:after:text-content-400" id="finding-io-saturation">Finding I/O saturation</a></h4><p>When <code>wa</code> (CPU wait) and <code>bo</code> (blocks out) soar while <code>r</code> remains modest, the CPU is idle but stuck waiting for the disk. Consider adding faster storage or tuning I/O scheduler parameters.</p>
<h4 id="detecting-cpu-over-commit" class="scroll-mt-20 md:scroll-mt-24 wrap-break-word group/heading "><a href="#detecting-cpu-over-commit" class="group-hover/heading:after:content-['#'] group-hover/heading:after:ml-1.5 group-hover/heading:after:text-content-400" id="detecting-cpu-over-commit">Detecting CPU over-commit</a></h4><p>A sustained <code>r</code> that is double the number of logical cores with low <code>wa</code> and plenty of <code>free</code> means CPU is the bottleneck, not memory or I/O. Use <code>top</code> or <code>htop</code> to locate the busiest processes to scale out workloads accordingly.</p>
<h2 id="conclusion" class="scroll-mt-20 md:scroll-mt-24 wrap-break-word group/heading "><a href="#conclusion" class="group-hover/heading:after:content-['#'] group-hover/heading:after:ml-1.5 group-hover/heading:after:text-content-400" id="conclusion">Conclusion</a></h2><p>Mastering <code>free</code> and <code>vmstat</code> gives you a lens into memory usage, swap activity, I/O latency, and CPU load. For everyday debugging: start with <code>free</code> to check if your system is truly out of memory, then use <code>vmstat</code> to reveal the reason, whether it&rsquo;s memory leaks, disk bottlenecks, or CPU saturation.</p>
<p>Stay tuned for the next piece in our &ldquo;System insights with command-line tools&rdquo; series and happy Linux troubleshooting!</p>
]]></content><category scheme="taxonomy:tags" term="toolbox" label="toolbox"/><category scheme="taxonomy:tags" term="free" label="free"/><category scheme="taxonomy:tags" term="vmstat" label="vmstat"/></entry></feed>