free Command in Linux

Learn via video courses
Topics Covered

Build an AI-First Career, Master the Complete Skillset

Choose from our industry-leading programs designed for career success

NSDC Certified

Modern Software and AI Engineering Program

Master full-stack development with AI integration

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Modern Data Science and ML with specialisation in AI

Advanced data science techniques with AI specialization

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Advanced AIML with Specialisation in Agentic AI

Deep dive into AIML with focus on Agentic systems

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

DevOps, Cloud & AI Platform Engineering

Build and manage AI-powered cloud infrastructure

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

AI Engineering Advanced Certification by IIT-Roorkee

Premier AI engineering certification from IIT-Roorkee

3 MonthsDuration
AI-LedCurriculum
Career SupportSupport
Program highlights
Go to Program
NSDC Certified

AI Forward Deployed Engineer Program

Full-stack engineering, production AI and client-facing consulting

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program

Overview

The 'free' command in Linux is a powerful tool used to display the total amount of free and used memory (RAM) in the system, as well as the buffers and cache used by the kernel. This information is essential for system administrators and users to monitor and manage memory usage.

Linux free Command Syntax

The syntax for the free command is as follows:

Where:

  • options: Flags that modify the behavior of the free command.

free Command Options:

  • -b: Display memory size in bytes.
  • -k: Display memory size in kilobytes (default).
  • -m: Display memory size in megabytes.
  • -g: Display memory size in gigabytes.
  • -h: Display memory size in a human-readable format (e.g., 1K, 234M, 2G).
  • -t: Display a line containing the totals.
  • -s N: Continuously display the report every N seconds.
  • -c N: Display the result N times, then exit. Requires the -s option.
  • --help: Display the help message and exit.
  • --version: Display version information and exit.
Sharpen Your Fundamentals with Free Learning

Example Usages

  • Display memory usage in the default format (kilobytes).:

    Output:

    Explanation: The output shows memory usage in kilobytes, with columns for total, used, free, shared, buffers/cache, and available memory.

  • Display memory usage in a human-readable format.:

    Output:

    Explanation: The output shows memory usage in a human-readable format, such as M for megabytes and G for gigabytes.

How Scaler Transformed Careers in Different Fields

₹23L
AVG CTC
SCALER PLACEMENT PROOF

Scaler learners achieved 2.5x salary growth with average post-Scaler CTC reaching ₹23L.

11,000+placements
650+companies
Verified data
Hiring Partners:
GoogleGoogleAmazonAmazonMicrosoftMicrosoftFlipkartFlipkartAdobeAdobe1200+ more

Tips

  • Combine the -t option with -h for a more comprehensive and human-readable report.

Advanced Use Cases of free Command in Linux

  • Display memory usage every 5 seconds for a total of 3 times.:

    Output:

    Explanation: The -s and -c options allow you to monitor memory usage over a period of time and for a specific number of iterations.

  • Display memory usage in gigabytes, with totals.:

    Output:

    Explanation: The output shows memory usage in gigabytes, and includes a line displaying the total memory for each column.

  • Display memory usage in megabytes, updating every 2 seconds.:

    Output:

    Explanation: The -s option allows you to monitor memory usage in real-time, with a specified interval between updates.

Turn Learning into Career Growth

1200+Hiring Partners
89%Placement Rate
11,000+Placements
147%Avg Salary Increment
2.5XCareer Growth
₹23 LPAAvg Post-Scaler Salary
1200+Hiring Partners
89%Placement Rate
11,000+Placements
147%Avg Salary Increment
2.5XCareer Growth
₹23 LPAAvg Post-Scaler Salary

Conclusion

  • The 'free' command in Linux displays memory usage information.

  • Various options are available to modify the output format and behavior.

  • The -h option provides a human-readable format for easier interpretation.

  • Combining -s and -c options allows monitoring memory usage over time and for a specified number of iterations.