On Linux-based systems like Ubuntu, process accounting offers useful information to assist you in monitoring user activities. Process accounting is a way of keeping track of and summarizing processes and commands on a system. Ubuntu provides you the option to enable
Now we will show you how to enable process accounting in Ubuntu. Firstly, we need to install the “acct” utility on our system to follow the procedure. So let’s start!
You can keep track of your processes by installing the “acct” utility in Ubuntu. It keeps track of user actions and permits you to see how long users have been connected to the system. This tool also provides a list of the commands and resources currently being used in the system. The “acct” utility runs in the system background; therefore, the system’s performance is unaffected.
To install acct on your Ubuntu system, write out this command in your terminal:
The error-free output declares that “acct” is successfully installed on your system. Now, enable the process accounting by utilizing the below-given command:
The output shows that process accounting is now enabled on your system, and it will save all of the data in the “var/log/account/pacct”:
In your Ubuntu terminal, execute the “ac” command to get the connection time statistics of the user. The “ac” command without any argument will let you know the hour-based connect time:
The “-d” option is added in the “ac” command to view the daily log in hour-based time:
To know about connect time of all system users, utilize the “-p” option in your “ac” command:
On our system, we only have a “linuxhint” user; that’s why the output is only showing time statistics for this user:
You can view the log-in time statistics of a particular user. For this, you have to add the username to the “ac” command as follows:
To check out the daily log-in time statistics of a particular user, add the “-d” option in the previous command:
The “sa” command summarizes the contents of the file containing the raw accounting data. If you want to list information of the commands executed by the users, then run the below-given command in your Ubuntu terminal:
In the other case, if you want to view the information of the users individually, then add the “-u” option in the “sa” command:
The “-m” option is added in the “sa” command to show the total number of user processes and their CPU time:
In the “sa” command, add the “-c” option to get the highest percentage of users:
The “lastcomm” command is used to display the list of last executed commands by the specified user:
If you want to disable process accounting, then you have to execute a below-given command in your terminal:
In Ubuntu, process accounting offers a lot of information about the processes that are functioning on your systems. It enables you to store the accounting records of both system and user activities, as well as the system resources used. The “acct” utility is used for enabling process accounting in Linux-based systems like Ubuntu. In this post, we have shared how to enable process accounting on your Ubuntu system. Moreover, we have also shown how to get the activity statistics in the terminal.
Microsoft Edge is now available for Ubuntu. In this guide, I’ll walk you through the…
Our latest Canonical website rebrand did not just bring the new Vanilla-based frontend, it also…
At Canonical, the work of our teams is strongly embedded in the open source principles…
Welcome to the Ubuntu Weekly Newsletter, Issue 873 for the week of December 29, 2024…
Have WiFi troubles on your Ubuntu 24.04 system? Don’t worry, you’re not alone. WiFi problems…
The following is a post from Mark Shuttleworth on the Ubuntu Discourse instance. For more…