
Linux Command Line
The “free” command in Linux is a useful tool for monitoring the system’s memory usage. It can be used to check the amount of available and used memory, as well as the amount of memory that is being used for caching and buffering.
When to use it: The “free” command is especially useful when troubleshooting memory-related issues on a Linux system. For example, if a system appears to be running slowly or if applications are crashing, the “free” command can help to determine if the problem is related to a lack of available memory.
How to use it: To use the “free” command, simply open a terminal window and type “free” followed by the enter key. This will display the amount of total, used, and available memory, as well as the amount of memory that is being used for caching and buffering.
Examples:
- By default, the “free” command will display the memory usage information in kilobytes. To display the information in megabytes, use the “-m” option.
$ free -m
- To get the memory usage information every 2 seconds, use the “-s” option followed by the number of seconds.
$ free -s 2
- To get the memory usage information with human-readable output, use the “-h” option.
$ free -h
The “free” command is a simple but powerful tool for monitoring memory usage on a Linux system. By understanding how to use the command and its various options, you can quickly and easily identify and troubleshoot memory-related issues.
See our list of 75 Linux commands you should know about.