accton command in Linux with Examples
'accton' is one of important Linux/Unix command which is used by the administrator to monitor user activities. It is used to turn on or turn off the process for accounting or change the info process accounting file. When the command is run in the terminal without any argument, it stops the process accounting.
Syntax
accton [OPTION] on|off| file_name
where,
- on: Turns on process accounting using the default or specified file.
- off: Turns off process accounting.
- file_name: Specifies the file where process accounting data should be saved.
The system’s default process accounting file is saved in ‘/var/log/account/pacct‘. The default path of the file might change with different Linux platforms i.e. it might be different for Red Hat or other Linux based platforms. Usually, the process accounting is enabled automatically at boot time by the system itself.
Linux accton Command Examples
Example 1: Turning On Process Accounting
Input:

Output:

Example 2: To turn off the process for accounting.
Input:

Output:

Example 3: To save process accounting in a particular file
Let's say the file name is 'geeksforgeeks.txt' we can use the following command.
accton geeksforgeeks.txt
Input:

Output:

Common Options Available with the accton Command
The 'accton' command supports several useful options to manage process accounting:
Option | Description |
---|---|
-h, --help | Displays help information and exits the command. |
-V, --version | Displays the version of the accton utility and exits. |
1. -h, –help
Shows help and exit.

2. -V, --version
Show version and exit.
Conclusion
The accton command is an essential tool for system administrators who need to monitor, log, and analyze user activities and system processes. The accton command provides a simple yet powerful way to manage process accounting in Linux whether you're managing security, auditing resource usage, or simply monitoring user behavior.