free command

The free command gives information about used and unused memory usage and swap memory of a system. By default, it displays memory in kb (kilobytes).

Memory mainly consists of RAM (random access memory) and swap memory.

Swap memory is a part of hard disk drive that acts like a virtual RAM.

Syntax:

Linux free1

Look at the above snapshot,

Line1tells about the memory details like total RAM available in our system, used RAM, free RAM, shared RAM, buffered RAM and cached RAM.

Line2indicates used and free buffer/cache memory.

Line3indicates total, used and free swap memory.


Displaying RAM in different format

By default, free command displays RAM information in kb format. You can display it in different format as per your wish.

Syntax:

Linux free2

free options

OptionFunction
free -tDisplay total memory
free -oDisable buffer adjusted line
free -s <time>To update RAM at regular intervals
free -lDisplay high and low memory size statistics
watch freeAllows iterations
Next TopicLinux free -t