Copied to clipboard

free

The free command is used to display the amount of free and used memory in the system.

Example

  • free: Displays statistics on memory usage, including total memory, used memory, free memory, and buffer memory.
  • free -b/k/m/g: Displays memory usage in different units. For example, use the m parameter to display memory usage in megabytes.
  • free -t: Shows the total memory column.
  • free -s: Specifies how often to output memory usage, in seconds.
  • free -c: Continuously outputs memory usage until the user interrupts.
  • free -a: Displays memory usage, including kernel buffer usage.
  • free -e: Displays detailed memory usage, including various aspects of memory usage.
  • free -n: Displays memory usage a certain number of times, then exits.
  • free -p: Displays the process with the highest memory usage.
  • free -r: Displays real-time memory usage.
  • free -u: Displays memory usage by user.
  • free -t -m: Displays memory usage in megabytes and shows the total memory column at the bottom.
  • free -s 5: Outputs memory usage every 5 seconds.