Scripting: How do I process accounting file /var/account/pact?

by nixcraft on March 17, 2006 · 0 comments

The file /var/account/pacct can not be used directly as it does not store accounting data in clear text format. Each time a process terminates a record for this process is appended to the accounting file.

In order to use this file to generate customize report from perl or shell script you need to convert this file in text format. You need to use dump-acct command which print an acct/pacct file in human-readable format.

# dump-acct /var/account/pacct

All fields are separated by vertical line. Fields are: command, user time, system time, effective time, uid, gid, memory, io, time. To print username and command you can use awk command in pipe as follows:

# dump-acct /var/account/pacct | awk -F'|' '{ print $1 " = " $5 }'

Please note that to print an utmp file in human-readable format use command dump-utmp as follows:

# dump-utmp /var/log/wtmp

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 8 + 5 ?
Please leave these two fields as-is:
Solve the simple math so we know that you are a human and not a bot.



Previous post:

Next post: