AC(8)

πŸ“¦
version 1042.100.6.0.1 Β· 2 versions
, in nixpkgs unstable

πŸ’– AC(8) β€” connect time accounting πŸ’–

okay bestie, so this is ac, section 8 of the System Manager's Manual, and she is literally the queen of connect time accounting. no cap. let's get into it πŸŽ€


✨ NAME ✨

ac β€” connect time accounting 🌸


✨ SYNOPSIS ✨

ac [-dp] [-t tty] [-w wtmp] [users ...]

✨ DESCRIPTION ✨

so here's the vibe: by default, a record of individual login and logout times gets written down by login(1) and init(8) respectively, and they send it to syslogd(8). πŸ“

then ac slides in, examines those records, and writes the accumulated connect time β€” in hours β€” for all logins to the standard output. that's it. that's the whole job. slay πŸ’…

🌈 the options, bestie

  • -d β€” display the connect times in 24 hour chunks. like, day-by-day energy ⏰
  • -p β€” print individual users' totals. so you get per-person receipts instead of one big number 🧾✨
  • -t tty β€” only do accounting logins on certain ttys. and okay this one is the fun one: the tty spec can start with ! to mean not this tty, and can end with * to mean all similarly named ttys. and yes you can stack multiple -t flags, go off πŸ‘‘
  • -w wtmp β€” read connect time data from wtmp instead of the default, which is reading from log(1). switch up your source, why not πŸ¦‹
  • users ... β€” display totals for the given individuals only. just the besties you asked for, nobody else πŸ™ˆ
and if no arguments are given at all? ac displays the total connect time for all accounts with login sessions recorded in log(1). the whole group chat, basically πŸ’œ

✨ FILES ✨

  • /var/run/utmpx β€” the connect time accounting file πŸ—‚οΈ

✨ EXIT STATUS ✨

ac exits 0 on success, and >0 if an error occurs. clean exits only, fr fr ✨


✨ EXAMPLES ✨

okay so picture this: you want times recorded in modems to be charged out at a different rate than the other ones. iconic. do this:

ac -p -t "ttyd*" > modems
ac -p -t "!ttyd*" > other

two files, two rates, zero stress 🫢


✨ SEE ALSO ✨

log(1), login(1), getutxent(3), utmpx(5), launchd(8), sa(8), syslogd(8) πŸ”₯


✨ HISTORY ✨

an ac command appeared in Version 5 AT&T UNIX. and this version of ac was written for NetBSD 0.9A, from the specification provided by various systems' manual pages. main character origin story honestly πŸ‘‘


πŸ’– and that's the whole page! this one's the Debian build, dated February 14, 2020 β€” happy valentine's day to connect time accounting and to you, bestie πŸ’–

πŸ“¦ where this page comes from