ac
display user connect time statistics
TLDR
Print how long the current user has been connected in hours
SYNOPSIS
ac [-d] [-p] [-y] [-f filename] [-a] [--compatibility] [people]
DESCRIPTION
ac generates a report of connect time in hours based on the logins and logouts recorded in the system's wtmp file. It calculates the difference between login and logout timestamps to determine how long each user has been connected. Output can be broken down by individual user, by day, or presented as an aggregate total. The wtmp file is maintained automatically by login-related system utilities such as login, sshd, and init.
PARAMETERS
-d, --daily-totals
Display totals for each calendar day instead of a single aggregate total-p, --individual-totals
Show connection time for each user separately plus overall totalpeople
Calculate combined connect time for specified usernames (space-separated list)-f, --file filename
Read accounting data from specified file instead of system wtmp-a, --all-days
Include daily records even when no login activity occurred-y, --print-year
Display year alongside date information-z, --print-zeros
Print category totals that equal zero--complain
Display errors when wtmp file contains anomalies--reboots
Include time accrued between user login and system reboot events--supplants
Count time from login to next login when logout records are missing--timewarps
Include time when chronological inconsistencies occur in wtmp--compatibility
Enable all three compatibility flags (reboots, supplants, timewarps)
CAVEATS
Connect time calculations depend on accurate wtmp records. System crashes or improper shutdowns may result in incomplete or inaccurate data.
HISTORY
Part of GNU Accounting Utilities, based on traditional UNIX accounting tools. The GNU version offers enhanced functionality compared to traditional implementations.
