FactorPad
Faster Learning Tutorials

Linux free command summary with examples

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.
Paul Alan Davis, CFA, October 28, 2016
Updated: August 3, 2018
In this tutorial, 53 of 100, below find a 3-4 minute introductory video, a text-based tutorial and all of the code examples from the video.

Outline Back Next

~/ home  / tech  / linux essentials  / free command


The Linux free command

Beginner

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

Video Tutorial

Linux free command summary with examples (3:12)

Videos can also be accessed from the YouTube Playlist.

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.

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 is in growth mode. Join the party. Subscribe here.

  • For the Outline to all 100 tutorials, click Outline.
  • To go back to the du command, hit Back.
  • For the next set of tutorials where we review text viewers and editors starting with pg, click Next.

Outline Back Next

~/ home  / tech  / linux essentials  / free command



 
 
Keywords:
Linux free command
free linux
unix free
linux free command examples
linux free memory
linux memory
check memory linux
linux ram usage
linux ram
linux memory size
check ram linux
free command
linux memory usage
linux cache memory
linux process memory usage
linux check memory usage
linux free ram