- Unix Commands Reference
- Unix - Tutorial Home
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
accton command in Linux with Examples
accton - turns process accounting on or off.
accton [OPTION] on|off|filename accton [ -V | --version ] [ -h | --help ]
-V, --version Print the version number of accton to standard output and quit. -h, --help Prints the usage information to standard output and quit.
on Activate process accounting and use default file for recording process accounting data. The system's default process accounting file is '/var/log/account/pacct'. off Deactivate process accounting. filename Activate (if not active) and save process accounting information in this file.
accton is the program used to administer or record (log) the commands executed by the system or the user on a Linux platform. It is used to monitor user activities in terms of resources like CPU time and memory. It is used to turn-on or turn-off the process of accounting. Process accounting here refers to the data related with the command.
Modern Linux kernel is capable of keeping a log of system accounting records of the commands that are executed. These records include information like – who executed the command, how long did the command run, the CPU time, and much more. Process accounting support has been integrated into the newer kernels (version >= 1.3.73). Although, this command is available on all modern Linux but its format is not standardised on all versions of Linux systems.
When process accounting is enabled, the kernel writes a record to the accounting file as each process on the system terminates. This record contains information about the terminated process. Records in the accounting file are ordered by the termination time of the process.
To turn on the process of accounting
#accton on Turning on process accounting, file set to the default '/var/log/account/pacct'.
To turn off the process of accounting
#accton off Turning off process accounting.
To save process accounting records to a particular file like 'myaccounting.log'
Create a file /var/log/account/myaccounting.log #touch /var/log/account/myaccounting.log This record file should be owned by the user root, and it has to have read−write permission for root and read permission for anybody else: #chown root /var/log/account/myaccounting.log #chmod 0644 /var/log/account/myaccounting.log #accton myaccounting.log Turning on process accounting, file set to 'myaccounting.log'.