Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ac(8) [opendarwin man page]

AC(8)							    BSD System Manager's Manual 						     AC(8)

ac -- display connect time accounting SYNOPSIS
ac [-d] [-p] [-w file] [users ...] DESCRIPTION
If the file /var/log/wtmp exists, a record of individual login and logout times are written to it by init(8) and login(8) respectively. The program ac examines these records and writes the accumulated connect time for all logins to the standard output. Options available: -d Display the connect times in 24 hour chunks. -p Display individual user totals. -w file Read raw connect time data from file instead of the default file /var/log/wtmp. users ... Display totals for the given individuals only. If no arguments are given, ac displays the total amount of login time for all active accounts on the system. The default wtmp file is an infinitely increasing file unless frequently truncated. This is normally done by the daily daemon scripts sched- uled by cron(8) which rename and rotate the wtmp files before truncating them (and keeping about a weeks worth on hand). No login times are collected however, if the file does not exist. FILES
/var/log/wtmp /var/log/wtmp.[0-7] rotated files SEE ALSO
init(8), sa(8), login(1), utmp(5). HISTORY
A ac command appeared in Version 6 AT&T UNIX. 4th Berkeley Distribution April 19, 1994 4th Berkeley Distribution

Check Out this Related Man Page

AC(8)							    BSD System Manager's Manual 						     AC(8)

ac -- connect time accounting SYNOPSIS
ac [-dp] [-t tty] [-w wtmp] [users ...] DESCRIPTION
If the file /var/log/utx.log exists, a record of individual login and logout times are written to it by login(1) and init(8), respectively. The ac utility examines these records and writes the accumulated connect time (in hours) for all logins to the standard output. The options are as follows: -d Display the connect times in 24 hour chunks. -p Print individual users' totals. -t tty Only do accounting logins on certain ttys. The tty specification can start with '!' to indicate not this tty and end with '*' to indicate all similarly named ttys. Multiple -t flags may be specified. -w wtmp Read connect time data from wtmp instead of the default file, /var/log/utx.log. users ... Display totals for the given individuals only. If no arguments are given, ac displays the total connect time for all accounts with login sessions recorded in utx.log. The default utx.log file will increase without bound unless it is truncated. It is normally truncated by the daily scripts run by cron(8), which rename and rotate the utx.log files, keeping a week's worth of data on hand. No login or connect time accounting is performed if /var/log/utx.log does not exist. FILES
/var/log/utx.log connect time accounting file EXIT STATUS
The ac utility exits 0 on success, and >0 if an error occurs. EXAMPLES
Allow times recorded in modems to be charged out at a different rate than other: ac -p -t "ttyd*" > modems ac -p -t "!ttyd*" > other SEE ALSO
login(1), getutxent(3), init(8), sa(8) BSD
January 21, 2010 BSD
Man Page

15 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remote Connection (SSH)

Hello all, I connect usually to one enviornment "dev" daily and then ftp some files to some other enviorment "uat" and then login to "uat" and run some scripts to process these files. I was thinking to automate the process, where running one script from "dev" will complete all task required... (11 Replies)
Discussion started by: RishiPahuja
11 Replies

2. Shell Programming and Scripting

detecting login or logout

what function would tell me that a user has logged in or out? i already know from my script the users name i already know in real time there was an event how an I tell if that event was a login or logout? Any ideas? # i did try comparing the file sizes for change but various users may... (8 Replies)
Discussion started by: nortypig
8 Replies

3. Shell Programming and Scripting

Cutting a large log file in to smaller ones

I have a very large (150 megs) IRC log file from 2000-2001 which I want to cut down to individual daily log files. I have a very basic knowledge of the cat, sed and grep commands. The log file is time stamped and each day in the large log file begins with a "Session Start" string like so: ... (11 Replies)
Discussion started by: MrTangent
11 Replies

4. UNIX for Advanced & Expert Users

Add User Problem

Hi all, I got a preconfigured Debian 4 (etch) box. When I add a user, it tells me it added and I can "su" as a new user but I can't login with it through SSH, SFTP, etc. Why? Thanks for your help. (30 Replies)
Discussion started by: mjdousti
30 Replies

5. Shell Programming and Scripting

greping last occurrence of the searched string

Hello, I have active log file i want to grep the last occurrence of the word in that log file the log file gets on increasing and increasing i want to fetch it from live file. Please guide me, Thanks in advance (4 Replies)
Discussion started by: vidurmittal
4 Replies

6. Shell Programming and Scripting

[Solved] Find Specific records from file and add totals into variables

Hi Eveyone, I am working on one shell script to find the specific records from data file and add the totals into variables and print them. you can find the sample data file below for more clarification. Sample Data File: PXSTYL00__20090803USA CHCART00__20090803IND... (7 Replies)
Discussion started by: veeru
7 Replies

7. Emergency UNIX and Linux Support

/var/log/wtmp SuSE log permission rollback

Hello All, On my SuSE system, I have wtmp log this log file permission is 644 but every reboot the file permission rollback to 664. In the logrotate.conf and logrotate.d/wtmp files the wtmp logrotate set to 644. I would like to know, which "file" or "script" modify the wtmp log to rollback to... (7 Replies)
Discussion started by: kalaso
7 Replies

8. AIX

How to find the year in last login details

Hi Friends I have a query. we had a requirement to see the last login details of our users so I ran the command last <username> and the output i get is: wtmp begins Apr 17 21:48 Now I need to know couple of things: 1. How can I see the year this log is being read from wtmp file 2. Is... (4 Replies)
Discussion started by: nathandrake13
4 Replies

9. Shell Programming and Scripting

awk on multiples files

Ques from newbie I want to total column X from large number of files, and view totals for each file separately with the filename. I have tried: for i in `ls -1 *.pattern`; do cat "$i" | awk '{SUM += $4} END { printf("%8d\t%8d\n", $i,SUM) }'; done does not work. appreciate your help (5 Replies)
Discussion started by: analyst
5 Replies

10. Shell Programming and Scripting

Making wtmp files readable one at a time

New Unix user/scripter here. Been trying to solve a problem for two days now with no luck. Hoping someone here has an answer. Essentially I have a list of wtmp files which I have decompressed and copied to a temporary directory. Using the following command I can turn them into a file than can... (4 Replies)
Discussion started by: Stryfe16
4 Replies

11. Shell Programming and Scripting

Can we run tail -f for a specified time?

Hi all, I want to check a log file that gets updated very frequently, almost every second. What I want to do from a script is to check this log file 1) for a particular string 2) for a specified time while it is getting updated. And as soon as it finds that particular string the command... (4 Replies)
Discussion started by: pat_pramod
4 Replies

12. Shell Programming and Scripting

Check for Specific Username Password Expire

hey Guys, I haven't posted in a while, But you guys were really helpful alst time. I have had a issue with User Passwords expiring, and since I dont check /var/cron/log on the regular I never know these suers are expiring, making certain nightly jobs not run. With this script, I want to be... (14 Replies)
Discussion started by: gkelly1117
14 Replies

13. Shell Programming and Scripting

Find users in 24 hour

How can I find that time when maximum number of users were login in last 24 hours. We have 500 users in that server. ---------- Post updated at 02:13 PM ---------- Previous update was at 01:17 PM ---------- on particular date 26-march-2013. Just for example we want to trace in which timings... (5 Replies)
Discussion started by: learnbash
5 Replies

14. Shell Programming and Scripting

Print n lines from top and n lines from bottom of all files with .log extenstion

Oracle Linux 6.4 In a directory I have more than 300 files with the extension .log I want the first 5 and last 5 lines of these .log files to be printed on screen with each file's name. Expected output : Printing first 5 and last 5 lines of FX_WT_Feb8_2014.log !! Authentication... (7 Replies)
Discussion started by: kraljic
7 Replies

15. UNIX for Beginners Questions & Answers

Understanding the difference between individual BASH login scripts

Hello... and thanks in advance for reading this or offering me any assistance I'm trying to understand specific differences between the various login scripts... I understand the differences between interactive vs non-interactive and login vs non-login shells... and that's not where my question... (4 Replies)
Discussion started by: bodisha
4 Replies

Featured Tech Videos