What is the usage of the sar command in Linux?
The sar command is a system performance monitoring tool used to gather, report, and analyze various performance data of the system. It provides statistical information on aspects such as CPU usage, memory usage, disk I/O, and network activity.
The usage of the sar command is as follows:
- Choose an option, time interval, and number.
- You can choose different types of reports such as -c (CPU usage), -m (memory usage), -d (disk I/O), -n (network activity), etc.
- Time interval: specifies the interval between sampled data.
- Frequency: indicates the number of times the sampled data is collected.
- sar -f filename
- Read data from a specified file using the sar command and generate a report.
- – Can you help me?
- Display all available report types.
The output of the sar command can be saved to a file for future analysis. You can use the command sar -o filename to save the results to a file, and then use sar -f filename command to read the file and generate a report.
In addition, other options of the sar command can be used to control the output format, select specific time ranges, and so on. You can use the man sar command to view detailed usage and options for the sar command.