sar 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 sar command is a versatile and powerful performance monitoring tool in Linux. It is used to collect, report, and store system activity information to help diagnose performance issues and identify potential bottlenecks. The command provides an overview of various system resources, such as CPU, memory, I/O, and network utilization.

Linux sar Command Syntax

The syntax for the sar command is as follows:

Where:

  • options: The options are the flags that determine which system resources to monitor.
  • interval: The interval specifies the time duration in seconds between successive reports.
  • count: The count determines the number of reports to display.

sar Command Options:

  • -A: Displays all available statistics.
  • -u: Displays CPU usage statistics.
  • -r: Displays memory usage statistics.
  • -b: Displays I/O and transfer rate statistics.
  • -n: Displays network statistics.
Sharpen Your Fundamentals with Free Learning

Example Usages

  • Monitor CPU usage every 5 seconds for 3 reports.:

    Output:

    Explanation: The command displays CPU usage statistics every 5 seconds for 3 reports.

  • Monitor memory usage every 10 seconds for 2 reports.:

    Output:

    Explanation: The command displays memory usage statistics every 10 seconds for 2 reports.

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

  • Use the -A flag to display all available statistics.

  • The sar command can also read data from a file using the -f option.

Advanced Use Cases of sar Command in Linux

  • Monitor network statistics every 15 seconds for 4 reports.:

    Output:

    Explanation: The command displays network statistics every 15 seconds for 4 reports.

  • Monitor I/O and transfer rate statistics every 20 seconds for 3 reports.:

    Output:

    Explanation: The command displays I/O and transfer rate statistics every 20 seconds for 3 reports.

  • Read and display data from a specific file.:

    Output:

    Explanation: The command reads data from the specified file and displays the corresponding statistics.

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

  • sar command is a powerful tool for monitoring system performance.

  • It can monitor various system resources, including CPU, memory, I/O, and network.

  • sar allows users to customize the monitoring interval and the number of reports displayed.

  • Advanced usages include reading data from a specific file.