SAR Command - System Activity Reporter | Online Free DevTools by Hexmos

Utilize the SAR command for system activity reporting. Monitor CPU, memory, disk, and network usage with this powerful Linux tool.

SAR Command - System Activity Reporter

The SAR (System Activity Reporter) command is a powerful utility in Linux for collecting, reporting, and saving system activity information. It allows you to monitor various aspects of your system's performance, including CPU utilization, memory usage, disk I/O, and network statistics. This tool is invaluable for system administrators and developers who need to diagnose performance issues, track resource consumption, and understand system behavior over time.

Monitor CPU Utilization

Understanding CPU load is critical for performance tuning. SAR provides detailed insights into how your CPU is being utilized.

# Reports CPU utilization every 2 seconds, 5 times:
sar -u 2 5

Analyze Specific CPU Cores

For systems with multiple cores, it's often useful to examine the load on individual processors.

# Report the CPU usage for a given core (e.g., core 1):
sar -P 1 1 3

Track Memory Usage Statistics

Monitor memory consumption, including used and free memory, as well as cache and buffer usage.

# Reports the amount of memory used, amount of memory free, available cache, available buffers every 1 second, 3 times:
sar -r 1 3

Examine Swapping Activity

Swapping can significantly impact system performance. SAR helps you identify excessive swapping.

# Reports statistics on swapping:
sar -S 1 3

Monitor File System Activity

Keep an eye on disk I/O and file system operations to identify potential bottlenecks.

# Reports on the file systems mounted every 2 seconds 5 times:
sar -F 2 5

Analyze Block Device Performance

Get detailed statistics on the performance of your block devices (hard drives, SSDs).

# Reports on the block devices every 1 second, 3 times:
sar -d 1 3

Inspect Network Interface Statistics

Monitor network traffic, including IPV4, TCPV4, ICMP, and identify any network-related errors.

# Reports on the network interface, network speed, IPV4, TCPV4, ICMP traffic and errors (excluding loopback interface):
sar -n DEV 1 3 | grep -v lo

External Resources: