• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

ac – Print statistics on how long users have been connected (Command Examples)

by admin

The “ac” command is used to print statistics on how long users have been connected to a system. It provides information about the total time that users have spent logged in or connected to a system, which can be helpful for monitoring user activity and system usage.

Here are some key points to understand about the “ac” command:

  • User Login Information: The “ac” command retrieves data from the system’s “wtmp” file, which contains records of user logins and logouts. It analyzes this information to calculate the duration of each user’s connection.
  • Time Format: The output of the “ac” command typically presents the user login statistics in a tabular format. It includes details such as the username, total login time, and the number of times the user has logged in.
  • Total Login Time: The “ac” command calculates the total time a user has been connected by summing up the durations of their individual login sessions. It provides this information in a human-readable format, typically displaying the total time in hours or days.
  • System-wide Statistics: In addition to user-specific information, “ac” may also provide overall system-wide statistics. This includes the total number of users currently logged in or the average duration of user sessions. These statistics can give administrators a quick overview of system usage and user activity.
  • Security and Audit Trail: The “ac” command can be useful for security purposes and auditing. By reviewing user login statistics, administrators can track user access patterns, identify unusual login behavior, or investigate suspicious activities.

It’s important to note that the availability and output format of the “ac” command may vary depending on the operating system and its configuration. On some systems, additional options may be available to customize the output or filter the displayed information.

ac Command Examples

1. Print how long the current user has been connected in hours:

# ac

2. Print how long users have been connected in hours:

# ac -p

3. Print how long a particular user has been connected in hours:

# ac -p username

4. Print how long a particular user has been connected in hours per day (with total):

# ac -dp username

Summary

In summary, the “ac” command provides administrators with insights into user login statistics, including the total time users have spent connected to a system. It aids in monitoring user activity, system usage, and can be utilized for security and auditing purposes.

Filed Under: Linux

Some more articles you might also be interested in …

  1. useradd Command Examples in Linux
  2. Unable to set a GRUB password on a Raspberry Pi 3 system
  3. Is there a CSS parent selector
  4. logsave: command not found
  5. Log watching using tail or less
  6. amixer: command not found
  7. Linux OS Service ‘squid’
  8. aws codecommit: AWS CodeCommit is a managed source control service that hosts private Git repositories
  9. umask: command not found
  10. “git stripspace” Command Examples

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright