Merge branch 'vendor/GDB'
[dragonfly.git] / usr.bin / lastcomm / lastcomm.1
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 .\" $DragonFly: src/usr.bin/lastcomm/lastcomm.1,v 1.3 2008/05/02 02:05:07 swildner Exp $
35 .\"
36 .Dd June 14, 2009
37 .Dt LASTCOMM 1
38 .Os
39 .Sh NAME
40 .Nm lastcomm
41 .Nd show last commands executed
42 .Sh SYNOPSIS
43 .Nm
44 .Op Fl EScesu
45 .Op Fl f Ar file
46 .Op Ar command ...\&
47 .Op Ar user ...\&
48 .Op Ar terminal ...\&
49 .Sh DESCRIPTION
50 The
51 .Nm
52 utility gives information on previously executed commands.
53 With no arguments,
54 .Nm
55 prints information about all the commands recorded
56 during the current accounting file's lifetime.
57 .Pp
58 The following options are available:
59 .Bl -tag -width indent
60 .It Fl E
61 Print the time the process exited.
62 .It Fl S
63 Print the time the process started.
64 .It Fl c
65 Print the amount of cpu time used by the process.
66 .It Fl e
67 Print the amount of elapsed time used by the process.
68 .It Fl s
69 Print the amount of system time used by the process.
70 .It Fl u
71 Print the amount of user time used by the process.
72 .It Fl f Ar file
73 Read from
74 .Ar file
75 rather than the default
76 .Pa /var/account/acct .
77 If
78 .Ar file
79 is a single dash
80 .Pq Sq \&-
81 .Nm
82 reads accounting entries from the standard input.
83 .El
84 .Pp
85 If no options are specified,
86 .Fl cS
87 is assumed.
88 If
89 .Nm
90 is invoked with arguments, only accounting entries with a
91 matching
92 .Ar command
93 name,
94 .Ar user
95 name,
96 or
97 .Ar terminal
98 name
99 are printed.
100 For example:
101 .Pp
102 .Dl lastcomm a.out root ttyd0
103 .Pp
104 would produce a listing of all the
105 executions of commands named
106 .Pa a.out
107 by user
108 .Ar root
109 on the terminal
110 .Ar ttyd0 .
111 .Pp
112 For each process entry, the following are printed.
113 .Pp
114 .Bl -bullet -offset indent -compact
115 .It
116 The name of the user who ran the process.
117 .It
118 Flags, as accumulated by the accounting facilities in the system.
119 .It
120 The command name under which the process was called.
121 .It
122 The amount of
123 CPU
124 .Pq Fl c ,
125 wall
126 .Pq Fl e ,
127 system
128 .Pq Fl s ,
129 or user
130 .Pq Fl u
131 time used by the process (in seconds).
132 .It
133 The time the process started
134 .Pq Fl S
135 or exited
136 .Pq Fl E .
137 .El
138 .Pp
139 The flags are encoded as follows: ``S'' indicates the command was
140 executed by the super-user, ``F'' indicates the command ran after
141 a fork, but without a following
142 .Xr exec 3 ,
143 .\" ``C'' indicates the command was run in PDP-11 compatibility mode
144 .\" (VAX only),
145 ``D'' indicates the command terminated with the generation of a
146 .Pa core
147 file, and ``X'' indicates the command was terminated with a signal.
148 .Pp
149 By default, accounting entries are printed going backwards in time,
150 starting from the time
151 .Nm
152 was executed.
153 However, if
154 .Nm
155 reads entries from its standard input, then entries are printed in
156 the order they are read.
157 .Sh FILES
158 .Bl -tag -width /var/account/acct -compact
159 .It Pa /var/account/acct
160 default accounting file
161 .El
162 .Sh EXAMPLES
163 The command
164 .Dl lastcomm -Ee
165 will print the exit time and elapsed time of each command logged in
166 .Pa /var/account/acct ,
167 while
168 .Dl tail -f -c 0 /var/account/acct | lastcomm -f -
169 will print details of each terminating command.
170 .Sh SEE ALSO
171 .Xr last 1 ,
172 .Xr sigvec 2 ,
173 .Xr acct 5 ,
174 .Xr core 5
175 .Sh HISTORY
176 The
177 .Nm
178 command appeared in
179 .Bx 3.0 .