Computer Memory and Linux®

You have memory where you sit and remember, well, computers have a similar thing.  And it’s also called memory.  Sounds kind of silly to also call it memory, but it actually kind of works.

Computers have two kinds of memory.  There’s hard drives, where it stores programs.  You can think of it like the memories you have.  You can sit there and remember watching Star Wars, right?  A computer can save all of Star Wars to its hard drive so you (or it, if it wants) can watch it again and again.

The other kind of memory is the thinking kind.  If I sit here and think about what Luke Skywalker and Rey have to say each other, that’s not the remembering kind of memory, that’s the thinking kind.  When your computer is running a program, it’s thinking.  When you look at a directory, it’s remembering.

So, how much thinking memory does my computer have?  Of course, there’s a command for that!  It’s called free.

Alpha:~ computerlamp$ free -g
             total       used       free     shared    buffers     cached
Mem:            31         29          1          0          0         12
-/+ buffers/cache:         17         13
Swap:            2          2          0

So when I used the -g flag, I wanted to know the results in gigabytes.  If I don’t use that flag, I get the results in bytes.  That doesn’t really mean much to me, so I’ll go with gigabytes.

The man page for free also tells me to ignore the shared column, that’s obsolete.

But back to the results.  The first column tells me I have 31 Gigabytes of memory on this system and 29 are used but 1 is free.  That’s weird, right?  Its because the system actually counts them in bytes and then divides things out (and rounds it off) for the results.  It wants to give you nice pretty numbers to look at.

The bottom row, that’s called swap and we’ll talk about it in the next post.

Leave a Reply

Your email address will not be published. Required fields are marked *