Best of Linux

What is free vs top in Linux?

what is free vs top in linux

Linux is a powerful and versatile operating system, and one of its many strengths is its ability to provide detailed information about system resources. Among the many commands available for monitoring your system’s resources, two of the most common are the free and top commands. In this article, we will delve into these essential Linux commands and explore their uses, options, and differences. By the end, you will have enough understanding of how to use these commands to your advantage.

Understanding Linux Commands

Linux is an operating system built on the Unix philosophy, which emphasizes small, modular utilities that can be combined to accomplish complex tasks. Commands are the primary way to interact with Linux, and they come in various forms, such as built-in shell commands or external programs.

The Free Command

The ‘free’ command is a multifunctional tool showcasing the aggregate amount of used and available memory within the system. It is an excellent way to get a quick snapshot of your system’s memory usage.

Understanding free command output

When you run the free command without any options, it displays a table with several columns, including:

  • Total: The total amount of memory installed on your system.
  • Used: The amount of memory currently in use by the system.
  • Free: The amount of memory currently available for use.
  • Shared: Memory used by tmpfs (temporary file storage in RAM).
  • Buff/cache: Memory used by the kernel buffers and cache.
  • Available: An estimate of the memory available for starting new applications without swapping.

Free Command Options

The ‘free’ command is accompanied by various options that can be utilized to customize its output, such as:

  • -b: Display output in bytes
  • -k: Display output in kilobytes (default)
  • -m: Display output in megabytes
  • -g: Display output in gigabytes
  • -h: Display output in a human-readable format

The Top Command

The top command is a powerful, interactive utility that provides a live, dynamic view of the processes running on your system. It serves as an excellent approach to tracking CPU usage, memory consumption, and other system performance indicators.

Understanding top command output

The output derived from the ‘top’ command is split into two parts. The first section contains a summary of system information, such as:

  • System uptime
  • Number of users
  • Load averages
  • Number of tasks
  • CPU usage
  • Memory usage

The subsequent section demonstrates a catalog of presently active processes, arranged in order of CPU usage percentage.

Top Command Shortcuts

The top command allows you to interact with the display using various keyboard shortcuts, including:

  • q: Quit the top command
  • P: Sort processes by CPU usage.
  • M: Sort processes by memory usage.
  • u: Display processes for a specific user.

Comparing free and top commands

Both the free and top commands provide valuable information about your system’s resources. However, they exhibit differences in their primary focus, functionality, and presentation style.

Advantages of the free command

Simplicity: The free command is easy to use and understand, making it ideal for quickly checking your system’s memory usage.

Static output: Unlike the top command, free provides a one-time snapshot of memory usage, making it easy to record or share the information.

Customizable display: The various options available with the free command allow you to tailor the output to your needs.

Advantages of the top command

Dynamic view: The top command provides a live, continuously updating view of your system’s processes and resource usage.

Detailed information: In addition to memory usage, the top command also displays information about CPU usage, load averages, and other system metrics.

Interactivity: With its keyboard shortcuts, top allows you to manage processes directly from the command output.


The free and top commands are essential tools for monitoring system resources in Linux. They provide valuable information about memory and process usage, helping you keep an eye on your system’s performance. Understanding and mastering the free and top commands will enable you to efficiently manage and optimize your Linux system.

Similar Posts