FactorPad
Build a Better Process

Linux free Command Summary with Examples

Linux free allows you to display memory in system RAM.
  1. Purpose - Learn what free is for and how to find help.
  2. Options - Review a few common options and arguments.
  3. Examples - Walk through code examples with free.
  4. A tip - Finish off with one more insight.
face pic by Paul Alan Davis, CFA
Updated: February 24, 2021
In this tutorial on Linux free, 53 of 100, below find a 3-4 minute introductory video, a text-based tutorial and all of the code examples from the videos.

Outline Back Tip Next

/ factorpad.com / tech / linux-essentials / free-command.html


An ad-free and cookie-free website.


Examples of the Linux free Command

Beginner

Learn to find used and free RAM memory at the Linux command line.

Video Tutorial

Videos can also be accessed from the Linux Essentials Playlist on YouTube.

Linux free Command Summary with Examples (3:12)

Video Script

The Command and Why You Need It

Our fifty-third word, or command to memorize is free from our category System.

free allows you to display memory in system RAM.

Common Linux free Options
-options description
--help Print help screen
-m, -mega Report memory in megabytes
-h, --human-readable Print memory with labels

Recall from the last three videos we've been reviewing memory usage on disks, now we'll shift the focus to memory in RAM.

Before we start, it helps to think of commands as mini programs and most follow this structure: command -option(s) argument(s).

The free command has 14 options and here there are no arguments, because you're just focused on one thing, RAM.

Like most commands, help is available with double-dash --help. The -m option is used for megabytes, and -h reports human-readable output with M for megabytes, G for gigabytes, and so on.

So why is free an important command? Well, if your system is sluggish, free will help you identify if a process is, in fact, eating up system resources. And now you know how to do that.

Demonstration

Okay, the best way to embed this in your memory is by typing in your own terminal window.

Find this on your Mac using a program called Terminal. On Linux use Terminal or Konsole, and currently Microsoft is adding this functionality to Windows.

Here we go. Let's go optionless.

$ free total used free shared buffers cached Mem: 1745328 450868 1294460 544 19448 171636 -/+ buffers/cache: 259784 1485544 Swap: 786428 0 786428

And see the output, it's pretty easy. This is fine, but a little tough to decipher, right?

Next, the -m option will show the same information in megabytes, which is easier to review quickly.

$ free -m total used free shared buffers cached Mem: 1704 440 1263 0 19 167 -/+ buffers/cache: 254 1450 Swap: 767 0 767

Seventeen hundred megabytes in RAM total, thirteen-hundred free. And here we'll just focus on these two figures for now.

And last, let's run free again using the human-readable option -h.

$ free -h total used free shared buffers cached Mem: 1.7G 440M 1.2G 544K 19M 167M -/+ buffers/cache: 253M 1.4G Swap: 767M 0B 767M

Notice how this is the easiest form to grasp. 1.7 Gigs total, 1.2 Gigs free, some megabyte measures here. Not bad, huh?

A Final Tip

Okay now you know how to use free. And you know the syntax for commands, options and arguments.

One last tip about the free command. So another option to keep in mind, is the -g option which presents everything in gigabytes, if you are in a high memory environment.

Okay, thanks for visiting today. I hope this was a helpful introduction to the free command.


Learn More About The Series

For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:


What's Next?

Our YouTube Channel and website are in growth mode. Join the party. Subscribe and follow.

Outline Back Tip Next

/ factorpad.com / tech / linux-essentials / free-command.html


linux free command
free linux
linux free
unix free
free unix
linux free examples
linux free memory
linux memory
free memory linux
check memory linux
linux ram usage
linux ram
linux memory usage
check ram linux
free command
linux cache memory
linux free command tutorial
linux memory usage
linux check memory usage
linux free command examples
linux process memory usage
linux memory size

A newly-updated free resource. Connect and refer a friend today.