On Unix-like operating systems, the ac command displays statistics about the amount of time users are connected to the system.

This page covers the Linux version of ac. On some package managers, the ac command is included as part of the package acct.

Description

ac prints out a report of connect time (in hours) based on the logins/logouts in the current wtmp file. A total is also printed out.

  • Description
  • Syntax
  • Options
  • Examples
  • Related commands
  • Linux commands help

The accounting file wtmp is maintained by init and login. Neither ac nor login creates the wtmp if it doesn’t exist, no accounting is done. To begin accounting, create the file with a length of zero.

GNU ac works nearly the same Unix ac, though it’s a little smarter in several ways. You should therefore expect differences in the output of GNU ac and the output of ac’s on other systems. Use the command info accounting to get additional information.

The wtmp file can get really big, really fast. You might want to trim it every once and a while.

Syntax

ac [ -d | –daily-totals ] [ -y | –print-year ] [ -p | –individual-totals ] [ people ] [ -f | –file file name ] [ -a | –all-days ] [ –complain ] [ –reboots ] [ –supplants ] [ –timewarps ] [ –compatibility ] [ –tw-leniency num ] [ –tw-suspicious num ] [ -z | –print-zeros ] [ –debug ] [ -V | –version ] [ -h | –help ]

Options

Examples

ac -d -y

Display daily results with the year as part of the date, similar to the example below:

Jul 3 total 1.17Jul 4 total 2.10Jul 5 total 8.23Jul 6 total 2.10Jul 7 total 0.30

bob 8.06goff 0.60maley 7.37root 0.12total 16.15

Mar 6 2013 total 45.41 Mar 7 2013 total 69.84 Mar 8 2013 total 50.96 Mar 10 2013 total 37.69 Mar 11 2013 total 2.21 Mar 12 2013 total 10.20 Mar 14 2013 total 48.00 Mar 15 2013 total 34.34 Mar 16 2013 total 56.76 Mar 17 2013 total 66.41 Mar 18 2013 total 70.18 Mar 19 2013 total 40.90 Mar 20 2013 total 21.29 Mar 23 2013 total 156.54 Mar 24 2013 total 67.71 Today total 133.35

login — Begin a session on a system.netstat — Print information about network connections, routing tables, interface statistics, masquerade connections, and multicast memberships.