lastcomm Command

Purpose

Displays information about the last commands executed.

Syntax

lastcomm [ -X ][ Command ] [ Name ] [ Terminal ]

Description

The lastcomm command displays information, in reverse chronological order, about all previously executed commands that are still recorded in the /var/adm/pacct summary file. You need to run the /usr/sbin/acct/startup command before you can execute the lastcomm command.

The list the lastcomm command displays can be restricted to:

For each process, the following information is displayed:

Flags

Item Description
-X Prints all available characters of each user name instead of truncating to the first 8 characters.

Examples

  1. To display information about all previously executed commands recorded in the /var/adm/pacct file, enter:
    lastcomm
  2. To display information about commands named a.out executed by the root user on the ttyd0 terminal, enter:
    lastcomm a.out root ttyd0
  3. To display information about all previously executed commands recorded in the /var/adm/pacct file without truncating the user name, enter:
    lastcomm -X

Files

Item Description
/usr/bin/lastcomm Contains the lastcomm command.
/var/adm/pacct The directory that contains the current accounting summary files.