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