xref: /dragonfly/usr.bin/lastcomm/lastcomm.1 (revision 07a2f99c)
1.\" Copyright (c) 1980, 1990, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer.
9.\" 2. Redistributions in binary form must reproduce the above copyright
10.\"    notice, this list of conditions and the following disclaimer in the
11.\"    documentation and/or other materials provided with the distribution.
12.\" 3. All advertising materials mentioning features or use of this software
13.\"    must display the following acknowledgement:
14.\"	This product includes software developed by the University of
15.\"	California, Berkeley and its contributors.
16.\" 4. Neither the name of the University nor the names of its contributors
17.\"    may be used to endorse or promote products derived from this software
18.\"    without specific prior written permission.
19.\"
20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\"	From: @(#)lastcomm.1	8.1 (Berkeley) 6/6/93
33.\" $FreeBSD: src/usr.bin/lastcomm/lastcomm.1,v 1.13.8.1 2007/04/18 05:53:50 dds Exp $
34.\"
35.Dd June 14, 2009
36.Dt LASTCOMM 1
37.Os
38.Sh NAME
39.Nm lastcomm
40.Nd show last commands executed
41.Sh SYNOPSIS
42.Nm
43.Op Fl EScesu
44.Op Fl f Ar file
45.Op Ar command ...\&
46.Op Ar user ...\&
47.Op Ar terminal ...\&
48.Sh DESCRIPTION
49The
50.Nm
51utility gives information on previously executed commands.
52With no arguments,
53.Nm
54prints information about all the commands recorded
55during the current accounting file's lifetime.
56.Pp
57The following options are available:
58.Bl -tag -width indent
59.It Fl E
60Print the time the process exited.
61.It Fl S
62Print the time the process started.
63.It Fl c
64Print the amount of cpu time used by the process.
65.It Fl e
66Print the amount of elapsed time used by the process.
67.It Fl s
68Print the amount of system time used by the process.
69.It Fl u
70Print the amount of user time used by the process.
71.It Fl f Ar file
72Read from
73.Ar file
74rather than the default
75.Pa /var/account/acct .
76If
77.Ar file
78is a single dash
79.Pq Sq \&-
80.Nm
81reads accounting entries from the standard input.
82.El
83.Pp
84If no options are specified,
85.Fl cS
86is assumed.
87If
88.Nm
89is invoked with arguments, only accounting entries with a
90matching
91.Ar command
92name,
93.Ar user
94name,
95or
96.Ar terminal
97name
98are printed.
99For example:
100.Pp
101.Dl lastcomm a.out root ttyd0
102.Pp
103would produce a listing of all the
104executions of commands named
105.Pa a.out
106by user
107.Ar root
108on the terminal
109.Ar ttyd0 .
110.Pp
111For each process entry, the following are printed.
112.Pp
113.Bl -bullet -offset indent -compact
114.It
115The name of the user who ran the process.
116.It
117Flags, as accumulated by the accounting facilities in the system.
118.It
119The command name under which the process was called.
120.It
121The amount of
122CPU
123.Pq Fl c ,
124wall
125.Pq Fl e ,
126system
127.Pq Fl s ,
128or user
129.Pq Fl u
130time used by the process (in seconds).
131.It
132The time the process started
133.Pq Fl S
134or exited
135.Pq Fl E .
136.El
137.Pp
138The flags are encoded as follows: ``S'' indicates the command was
139executed by the super-user, ``F'' indicates the command ran after
140a fork, but without a following
141.Xr exec 3 ,
142.\" ``C'' indicates the command was run in PDP-11 compatibility mode
143.\" (VAX only),
144``D'' indicates the command terminated with the generation of a
145.Pa core
146file, and ``X'' indicates the command was terminated with a signal.
147.Pp
148By default, accounting entries are printed going backwards in time,
149starting from the time
150.Nm
151was executed.
152However, if
153.Nm
154reads entries from its standard input, then entries are printed in
155the order they are read.
156.Sh FILES
157.Bl -tag -width /var/account/acct -compact
158.It Pa /var/account/acct
159default accounting file
160.El
161.Sh EXAMPLES
162The command
163.Dl lastcomm -Ee
164will print the exit time and elapsed time of each command logged in
165.Pa /var/account/acct ,
166while
167.Dl tail -f -c 0 /var/account/acct | lastcomm -f -
168will print details of each terminating command.
169.Sh SEE ALSO
170.Xr last 1 ,
171.Xr sigaction 2 ,
172.Xr acct 5 ,
173.Xr core 5
174.Sh HISTORY
175The
176.Nm
177command appeared in
178.Bx 3.0 .
179