accton Command in Linux

The accton command is a powerful tool in the Linux operating system, used primarily by system administrators to monitor user activities by turning on or off the process accounting system. Process accounting is a method that logs detailed information about the commands executed by users, providing insights into resource usage such as CPU time and memory.

The accton command in Linux is a utility used by system administrators to control the process accounting system, which tracks user activities and system resource consumption. When invoked without any arguments, "accton" will stop the process of accounting.

Table of Contents

Understanding the "accton" Command in Linux

The "accton" command's primary function is to enable or disable the process accounting feature. When enabled, the system keeps a log of executed commands, along with associated data such as execution time and resources consumed.

Prerequisite: Install accton

The command <sudo apt install acct> is a prerequisite because it installs the "acct" package which provides a suite of utilities for monitoring process activities. This package is essential for system administrators to track system usage and prepare performance reports −

sudo apt install acct
accton Command Linux 1


The basic syntax of the "accton" command is as follows −

accton [OPTION]... [FILE]

Where "OPTION" can be "--help" to display a help message, or "--version" to show the version number. The "FILE" is the name of the file where process accounting information will be saved. If no file is specified, process accounting is turned off.

To manage the accounting process, "accton" provides several options −

  • accton on − This option turns on process accounting using the system's default accounting file, typically located at "/var/log/account/pacct".
  • accton off − Conversely, this option turns off process accounting.
  • accton filename − By specifying a filename, you can direct "accton" to start the process of accounting and save the records to the specified file.

Additionally, "accton" supports a couple of standard flags for displaying help and version information −

  • -V or --version − This flag will print the version number of the "accton" command to standard output and then exit.
  • -h or --help − This flag will display usage information, including a brief description and a list of all available options, to standard output and then exit.

Important − Remember, the exact syntax and options may vary slightly depending on your Linux distribution.

How to use accton Command in Linux?

In Linux, the "accton" command is used to enable or disable process accounting, or to change the file where process accounting information is stored. Let's follow several examples of accton Command in Linux −

Example 1: Enabling Process Accounting

To enable process accounting, one would typically use the "accton" command with the `on` option. This starts the logging of process information to the default file or to a specified file. Let’s turn on process accounting and use the default file −

sudo accton on
accton Command Linux 2

Example 2: Disabling Process Accounting

If there's a need to stop the logging of process information, using the "accton" command with the "off" option will cease all process accounting activities. Let’s turn off process accounting −

sudo accton off
accton Command Linux 3

Example 3: Default Accounting File

Administrators may choose to log the accounting information to a custom file for organizational purposes or to adhere to specific logging policies. The default process accounting file is typically located at "/var/log/account/pacct", although this can vary depending on the Linux distribution −

sudo nano accton /var/log/account/pacct
accton Command Linux 4

Example 4: Customize the Accounting File

In Linux, the "accton" command is used to enable or disable process accounting, or to change the file where process accounting information is stored.

For example, to turn on process accounting and save the information to a file named "ubuntu_file.txt", you would use the below command. This command will start recording process accounting data to the specified file.

sudo accton ubuntu_file.txt
accton Command Linux 5

Example 5: Check the accton Version

To check the version of the "accton" utility installed on your system, you would use the "--version" option. Upon execution, it will display the version number of the "accton" program to the standard output and then exit. This command is particularly useful when you need to confirm that you have the correct version of "accton" for compatibility or functionality purposes −

accton Command Linux 6

Example 6: accton usage Information

The "accton" command in Linux is used to control process accounting, which is a way to track system resource usage. The "--help" option with `accton` provides usage information.

For example, running "accton --help" in the terminal would display help text detailing how to use the command, including its syntax and options −

accton Command Linux 7

Practical usage of "accton" Command in Linux

Process accounting can be invaluable for system monitoring and troubleshooting. By analyzing the accounting logs, administrators can determine which commands were executed, by whom, and the resources they consumed. This can help in identifying system abuse or simply in optimizing resource allocation.

Precautions and Consideration

It's important to note that process accounting is typically enabled automatically at boot time by the system. However, administrators can use "accton" to change the file where accounting data is stored or to manually turn the accounting process on or off as needed.

For more detailed information and examples, you can refer to the accton manual page or other online resources.


The "accton" command is a testament to the flexibility and control offered by Linux systems for user activity monitoring. It provides a simple yet robust interface for managing process accounting, an essential aspect of system administration. Use the "accton" command wisely to ensure your Linux systems are well-monitored and secure.