sar Command in Linux
Transform Your Career
Choose from our industry-leading programs designed for career success
Modern Software and AI Engineering Program
Master full-stack development with AI integration
+1000 moreModern Data Science and ML with specialisation in AI
Advanced data science techniques with AI specialization
+1000 moreAdvanced AIML with Specialisation in Agentic AI
Deep dive into AIML with focus on Agentic systems
+1000 moreDevOps, Cloud & AI Platform Engineering
Build and manage AI-powered cloud infrastructure
+1000 moreAI Engineering Advanced Certification by IIT-Roorkee
Premier AI engineering certification from IIT-Roorkee
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.
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.
Scaler Placement Report and Statistics
Scaler learners achieved 2.5x salary growth with average post-Scaler CTC reaching ₹23L.
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
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.




