xref: /illumos-gate/usr/src/man/man1/lastcomm.1 (revision 66582b606a8194f7f3ba5b3a3a6dca5b0d346361)
te
Copyright (c) 2000, Sun Microsystems, Inc.
All Rights Reserved.
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
LASTCOMM 1 "May 13, 2017"
NAME
lastcomm - display the last commands executed, in reverse order
SYNOPSIS

lastcomm [-f file] [-x] [command-name] ... [user-name] ...
 [terminal-name] ...
DESCRIPTION

The lastcomm command gives information on previously executed commands. lastcomm with no arguments displays information about all the commands recorded during the current accounting file's lifetime. If called with arguments, lastcomm only displays accounting entries with a matching command-name, user-name, or terminal-name. If extended process accounting is active (see acctadm(1M)) and is recording the appropriate data items, lastcomm attempts to take data from the current extended process accounting file. If standard process accounting is active, lastcomm takes data from the current standard accounting file (see acct(2)).

If terminal-name is `- -', there was no controlling TTY for the process. The process was probably executed during boot time. If terminal-name is `??', the controlling TTY could not be decoded into a printable name.

For each process entry, lastcomm displays the following items of information:

The command name under which the process was called.

One or more flags indicating special information about the process. The flags have the following meanings:

F

The process performed a fork but not an exec.

S

The process ran as a set-user-id program.

The name of the user who ran the process.

The terminal which the user was logged in on at the time (if applicable).

The amount of CPU time used by the process (in seconds).

The date and time the process exited.

OPTIONS

The following options are supported: -f file

Uses file as the source of accounting data. file may be either an extended process accounting file or a standard process accounting file.

-x

Uses the currently active extended process accounting file. If extended processing accounting is inactive, no output will be produced.

EXAMPLES

Example 1 Listing executions of named commands

The command

example% lastcomm a.out root term/01

produces a listing of all the executions of commands named a.out by user root while using the terminal term/01.

Example 2 Listing all user commands

The command

example% lastcomm root

produces a listing of all the commands executed by user root.

FILES
/var/adm/pacct

standard accounting file

/var/adm/exacct/proc

extended accounting file

SEE ALSO

last(1), acctadm(1M), acct(2), acct.h(3HEAD), core(4), attributes(5)