Command of the Day: free

May 5, 2007

After getting everything installed and working for a few days I wanted to get a feel for some basic metrics:

  1. Memory consumption
  2. Disk space usage
  3. Running processes
  4. CPU usage

Basically I wanted to have the info I get from the Windows Task Manager + disk usage.

I’ll take those in order – today is “free”.

Free displays memory usage stats in bytes, kilobytes or megabytes. Also it can display on a timer (every N seconds). Pretty straight forward and easy to follow.

@desktop:~$ free
total       used       free     shared    buffers     cached
Mem:       1002500     475980     526520          0      60156     267344
-/+ buffers/cache:     148480     854020
Swap:      2096472          0    2096472

Next CotD will cover disk space usage.

9 Responses to “Command of the Day: free”

  1. Walker Says:

    Yeah.. if you type “free -m”, it will display memory usage in megabytes, but when you type “free -g”, it will display in gigabytes. It’s more readable😉

  2. anon Says:

    For something closer to the windows task manager you could use top.
    http://www.mcsr.olemiss.edu/cgi-bin/man-cgi?top+1

  3. makingtheswitch Says:

    Re anon: – “top” is on the list for the next few days.🙂

  4. Eric Says:

    gnome-system-monitor is pretty much exactly what you’re looking for.

    You can have a launcher on your menu bar, but I just added the System Monitor widget to my bar that monitors CPU usage, and when I click it, I get the System Monitor popping up.

    Hoorah!

  5. mole.dog Says:

    Why does “free” and the “system monitor” give different values for memory use. For example, “free” says mem: 471 free 372 used, while “system monitor” says User Memory: 211.1 MB of 472.0 MB. “Free” reports more memory consumption than “system monitor”. I am just curious about this, so I thought I’d throw it out there. Thanks…

  6. MRibecky Says:

    For disk usage you might want to look at “df”, it displays statistics of current mounted filesystems.

  7. makingtheswitch Says:

    Re; MRibecky,

    Yup – I plan to cover that tomorrow.🙂

  8. Mark Czubin Says:

    @mole.dog:

    Well with ‘free’ you’ll get the complete memory usage which includes files from the harddisk cached into memory to speed up IO. Hard disks are SLOW🙂
    It’s a waste not to use your complete available memory. As soon as one app needs more ram, then the ram of the cache will be immediate free. (system keeps always a portion ready)

    gnome-system-monitor is offcourse more user friendly and gives your memory usage without the buffers+caches so not to confuse the end user. (“Wow linux always uses 90% of you memory regardless of the ammount”😉

  9. Rick Creech Says:

    Mark, thanks…


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: