Member-only story

Linux — ac Command Introduction

Tony
4 min readJan 5, 2024

What is ac Command

The ac command is a handy tool in the Linux command-line toolkit that allows you to report total user connect times. The name ac stands for “All Connection” times. This command reads the /var/log/wtmp file, which contains binary data about every login, logout, system event, and current status on the system.

The ac command is part of the suite of utility programs that have been incorporated into Unix and Unix-like systems over the years. It stands for “Accounting”, reflecting its original purpose in tracking system usage for accounting purposes.

Here’s how ac command works:

  • When you run the ac command, it reads the /var/log/wtmp file by default. It processes the binary data in this file to calculate the total login time for all users or a specific user.
  • If you use the -f option with ac to specify a different accounting file, ac will read that file instead.
  • The ac command adds up all the login times from the entries it finds in the accounting file(s). It then outputs this total time, typically in hours.

/var/log/wtmp File

The /var/log/wtmp file in a Unix-like operating system is a system log file that keeps track of all logins and logouts to the system. The wtmp file is a…

--

--

Tony
Tony

Responses (3)