December 23, 2024

If there are multiple users using Linux Mint / Ubuntu, often it becomes important to list out how much time (in hours) is a specific user actually logged in and other similar stats especially in work environment.

A simple tool for this especially for the Linux system administrators is the ac (short for accounting) which displays a report of total connect time of different users along with the total. This is a text based tool and nothing fancy but is powerful when one needs to use it in compiling user reports or include it in a shell script.

To install it first, type sudo apt-get install acct

Once installed, time to get some user auditing done 🙂

Typing ac -p lists the connect time of different users. (In this example, only one user uses the system).

Typing ac -d generates a daily connect time usage for all available users.

Combining specific user wise daily report is done by typing ac -pd.

(The way ac works is by reading the /var/log/wtmp file which keeps a record of user connect time in hours.This file is read by init and login processes).

As with all Linux Mint / Ubuntu commands, manual command is your best friend and typing man ac will be useful in getting ac to use as preferred. Related post about using man can be found here.

Happy user accounting.

By admin

Related Post