GNU accounting utilities or Acct is a free and open source application for Linux. Using Acct you can get details about system usage, connections, users info, programs executed, and utilization of system resources. It will help system administrators to analyze, investigate and diagnose the users’ activities and more things. In this article we will see how to monitor user activity in Ubuntu using GNU accounting utilities
How to Install Acct on Ubuntu
In the terminal application run below Acct installation command. It will install the latest version of Acct on your Ubuntu Linux system.
sudo apt install acct
It will start automatically after installing it.Now check and verify whether acct service is running or not.
sudo systemctl status acct
You can also turn ON and OFF accounting using below commands.
accton on
If you want to OFF use below command.
accton off
You can can summarize the information about previously executed commands using sa command.
Example:
Show summary of all commands
sa
View number of processes and CPU minutes
sa -m
Print user id and command name
sa -u
Using lastcomm command you can display the list of previously executed commands.
Example:
lastcomm
For the complete details about lastcomm run below command.
man lastcomm
The ac command will display the report of user connect time in hours.
Example:
Display total connect time of all users
ac
Total connect of all users by day
ac -d
Total connect time by user
ac -p
Total connect time of a specific user
ac manikandan
For the complete details run below command.
man ac