1.\" $NetBSD: lastcomm.1,v 1.11 2006/12/22 08:00:20 ad Exp $ 2.\" 3.\" Copyright (c) 1980, 1990, 1993 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. Neither the name of the University nor the names of its contributors 15.\" may be used to endorse or promote products derived from this software 16.\" without specific prior written permission. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" SUCH DAMAGE. 29.\" 30.\" @(#)lastcomm.1 8.1 (Berkeley) 6/6/93 31.\" 32.Dd December 22, 2006 33.Dt LASTCOMM 1 34.Os 35.Sh NAME 36.Nm lastcomm 37.Nd show last commands executed in reverse order 38.Sh SYNOPSIS 39.Nm 40.Op Fl f Ar file 41.Op Ar command ... 42.Op Ar user ... 43.Op Ar terminal ... 44.Sh DESCRIPTION 45.Nm 46gives information on previously executed commands. 47With no arguments, 48.Nm 49prints information about all the commands recorded 50during the current accounting file's lifetime. 51.Pp 52Option: 53.Pp 54.Bl -tag -width Fl 55.It Fl f Ar file 56Read from 57.Ar file 58rather than the default 59accounting file. 60.El 61.Pp 62If called with arguments, only accounting entries with a 63matching 64.Ar command 65name, 66.Ar user 67name, 68or 69.Ar terminal 70name 71are printed. 72So, for example: 73.Pp 74.Dl lastcomm a.out root ttyd0 75.Pp 76would produce a listing of all the 77executions of commands named 78.Pa a.out 79by user 80.Ar root 81on the terminal 82.Ar ttyd0 . 83.Pp 84For each process entry, the following are printed. 85.Pp 86.Bl -bullet -offset indent -compact 87.It 88The name of the user who ran the process. 89.It 90Flags, as accumulated by the accounting facilities in the system. 91.It 92The command name under which the process was called. 93.It 94The amount of cpu time used by the process (in seconds). 95.It 96The time the process started. 97.It 98The elapsed time of the process. 99.El 100.Pp 101The flags are encoded as follows: 102.Dq S 103indicates the command was 104executed by the super-user, 105.Dq F 106indicates the command ran after 107a fork, but without a following 108.Xr exec 3 , 109.Dq C 110indicates the command was run in PDP-11 compatibility mode 111(VAX only), 112.Dq D 113indicates the command terminated with the generation of a 114.Pa core 115file, and 116.Dq X 117indicates the command was terminated with a signal. 118.Pp 119The 120.Dq S 121and 122.Dq C 123flags are no longer recorded by the system, but will be reported by 124.Nm 125when reading from an accounting file generated by an older version 126of the system. 127.Sh FILES 128.Bl -tag -width /var/account/acct -compact 129.It Pa /var/account/acct 130Default accounting file. 131.El 132.Sh SEE ALSO 133.Xr last 1 , 134.Xr sigaction 2 , 135.Xr acct 5 , 136.Xr core 5 137.Sh HISTORY 138The 139.Nm 140command appeared in 141.Bx 3.0 . 142