prtacct Command

Purpose

Formats and displays files in tacct format.

Syntax

/usr/sbin/acct/prtacct [ -X ] [ -W ] [  -f Fields ] [  -v ] File"Heading" ]

Description

The prtacct command formats and displays any total-accounting file; these files are in tacct format. You can enter this command to view any tacct file, such as the daily reports on connect time, process time, disk usage, and printer usage. To specify a title for the report with the Heading parameter, enclose the heading text in " " (quotation marks).

Flags

Item Description
-f Fields Selects fields to be displayed, using the field-selection mechanism of the acctmerg command.
-v Produces verbose output in which more precise notation is used for floating-point numbers.
-W Processes all available characters for each user name instead of truncating to the first 8 characters. This flag causes the prtacct command to expect to read in tacctx structures. It will then print out in the same column order, but it will allow long user names to misalign the columns. If the -W flag and the -X flag are used together, the -X takes precedence.
-X Processes all available characters for each user name instead of truncating to the first 8 characters. This flag causes the prtacct command to expect to read in tacctx structures and print out the user name in the last column. If the -W flag and the -X flag are used together, the -X will take precedence.

Security

Access Control: This command should grant execute (x) access only to members of the adm group.

Examples

To format and display selected records from the total accounting file for connect-time accounting, you first must create a file upon which to execute the prtacct command. In this example, you create the tacct file using the acctcon1 and acctcon2 commands. Enter:

tail /var/adm/wtmp > wtmp.sav
 
acctcon1 -t < wtmp.sav | sort +1n +2 | acctcon2 > tacct

If you created this file previously to process connect-time accounting data, you do not need to create it again.

The next step uses the prtacct command with the -f flag to display the fields of data in the total-accounting file that you want to see. The text for a heading can be included in quotation marks. To view the login name, prime connect-time, and nonprime connect-time records, and include the heading, Connect-time Accounting, enter:

prtacct -f 2,11,12 tacct "Connect-time Accounting"

You can also use this command to format and display other total-accounting files, such as the daily reports on process time, disk usage, and printer usage.

Files

Item Description
/usr/sbin/acct The path to the accounting commands.
/var/adm/pacct Current file for process accounting.
/var/adm/pacct* Used if the pacct file gets too large.