accton - Linux


accton is a Linux command that controls the accounting and audit session by starting or stopping it. It is primarily used to track and manage user activities, resource usage, and system events for security, performance analysis, and billing purposes. accton is commonly employed in corporate or enterprise environments where accountability and resource optimization are essential.


accton [-g] [-k] [-s]


| Flag | Description | Default |
| -g | Turn on accounting | Off |
| -k | Turn off accounting | Off |
| -s | Display current accounting status | Off |


Start accounting:

accton -g

Stop accounting:

accton -k

Display accounting status:

accton -s

Common Issues

Error: "Permission denied"

  • Ensure you are running the command with sufficient privileges. Try using sudo.

Error: "Account file not created"

  • Verify that the file /var/account/pacct has write permissions.


Example script to start accounting at login and stop it at logout:


# Start accounting at login
if [[ "$(accton -s)" != "on" ]]; then
  accton -g

# Stop accounting at logout
trap "accton -k" EXIT

Related Commands

  • last – Display list of last logged-in users
  • lastcomm – Show commands executed by a user
  • sa – System activity monitor