LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

sar

Collect and report system activity statistics

TLDR

Report I/O statistics every second
$ sar -b 1
copy
Report network statistics every 2 seconds, 10 times
$ sar -n DEV 2 10
copy
Report CPU utilization every 2 seconds
$ sar -u ALL 2
copy
Report memory utilization
$ sar -r ALL 1 20
copy
Report run queue and load averages
$ sar -q 1
copy
Report paging statistics
$ sar -B 5
copy
Report disk statistics
$ sar -d 1
copy

SYNOPSIS

sar [options] [interval [count]]

DESCRIPTION

sar (System Activity Reporter) collects, reports, and saves system activity information. It can report on CPU, memory, I/O, network, and other subsystem performance.

PARAMETERS

-b

Report I/O and transfer rate statistics
-B
Report paging statistics
-d
Report disk I/O statistics
-n KEYWORD
Report network statistics (DEV, EDEV, NFS, SOCK, IP, etc.)
-q
Report queue length and load averages
-r [ALL]
Report memory utilization statistics
-u [ALL]
Report CPU utilization
-v
Report status of inode, file, and other kernel tables
-w
Report task creation and system switching activity
-W
Report swapping statistics
-y
Report TTY devices activity
-f FILE
Read data from specified file
-o FILE
Write data to specified file
-s TIME
Set start time for report
-e TIME
Set end time for report
-P {cpu|ALL}
Report per-processor statistics
-j {ID|LABEL|PATH|UUID}
Display persistent device names

CONFIGURATION

/var/log/sa/

Directory containing binary system activity data files collected by sadc, named sa01-sa31 by day of month.
/etc/sysstat/sysstat
Sysstat configuration file controlling data collection intervals, retention, and compression settings.

INSTALL

sudo dnf install sysstat
copy
sudo pacman -S sysstat
copy
sudo apk add sysstat
copy
sudo zypper install sysstat
copy
brew install sysstat
copy
nix profile install nixpkgs#sysstat
copy

CAVEATS

Without interval, sar reads from system activity data files. Data is collected by the sadc daemon and stored in /var/log/sa/. Historical data requires sysstat cron jobs to be enabled.

HISTORY

sar is part of the sysstat package, originally from System V Unix. It provides comprehensive system activity reporting and historical data analysis.

SEE ALSO

iostat(1), mpstat(1), pidstat(1), sadc(8)

Copied to clipboard
Kai