Linux command
ac 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Example
ac
Example
ac -p
Example
ac -p [username]
Example
ac -d -p [username]
Example
ac --compatibility
说明
ac generates a report of connect time in hours based on the logins and logouts recorded in the system's wtmp file. It calculates the difference between login and logout timestamps to determine how long each user has been connected. Output can be broken down by individual user, by day, or presented as an aggregate total. The wtmp file is maintained automatically by login-related system utilities such as login, sshd, and init.
参数
- -d, --daily-totals
- Display totals for each calendar day instead of a single aggregate total
- -p, --individual-totals
- Show connection time for each user separately plus overall total
- people
- Calculate combined connect time for specified usernames (space-separated list)
- -f, --file filename
- Read accounting data from specified file instead of system wtmp
- -a, --all-days
- Include daily records even when no login activity occurred
- -y, --print-year
- Display year alongside date information
- -z, --print-zeros
- Print category totals that equal zero
- --complain
- Display errors when wtmp file contains anomalies
- --reboots
- Include time accrued between user login and system reboot events
- --supplants
- Count time from login to next login when logout records are missing
- --timewarps
- Include time when chronological inconsistencies occur in wtmp
- --compatibility
- Enable all three compatibility flags (reboots, supplants, timewarps)
FAQ
What is the ac command used for?
ac generates a report of connect time in hours based on the logins and logouts recorded in the system's wtmp file. It calculates the difference between login and logout timestamps to determine how long each user has been connected. Output can be broken down by individual user, by day, or presented as an aggregate total. The wtmp file is maintained automatically by login-related system utilities such as login, sshd, and init.
How do I run a basic ac example?
Run `ac` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -d, --daily-totals do in ac?
Display totals for each calendar day instead of a single aggregate total