As a common interview question, you need to know how to check the memory of your Linux OS. And this is done by running
free -mh. Usually, I add the
h, so the output is displayed in human-readable format, in megabytes (MB). Moving on, here’s the command output briefly explained.
total: This column shows the total amount of physical memory in the OS, including all RAM, swap space, and kernel reserved memory.
used: Shows the amount of memory that is currently being used. used = total - free – buffers – cache.
free: Shows the amount of memory that isn’t currently being used by the system. The pure free memory.
shared: Shows the amount of memory that is being shared among multiple processes. Mostly used by tmpfs.
buff/cache: Shows the amount of memory used by the kernel buffers in order to cache data for faster access, and by the page cache. Buffers cache file metadata, page cache is used to cache file contents.
available: Shows the amount of memory that is available for new processes to use.
If you have any feedback or constructive criticism, feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.