]> CyberLeo.Net >> Repos - FreeBSD/stable/8.git/blob - usr.bin/lastcomm/lastcomm.1
MFC r235541:
[FreeBSD/stable/8.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$
34 .\"
35 .Dd May 17, 2012
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 Cm + Ns Ar format
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 An operand with a leading plus sign
86 .Pq Sq +
87 is followed a user-defined format string which specifies the format
88 in which to display the process's start or exit date and time.
89 The format string may contain any of the conversion specifications
90 described in the
91 .Xr strftime 3
92 manual page, as well as arbitrary text.
93 .Pp
94 If no options are specified,
95 .Fl cS
96 is assumed.
97 If
98 .Nm
99 is invoked with arguments, only accounting entries with a
100 matching
101 .Ar command
102 name,
103 .Ar user
104 name,
105 or
106 .Ar terminal
107 name
108 are printed.
109 For example:
110 .Pp
111 .Dl lastcomm a.out root ttyd0
112 .Pp
113 would produce a listing of all the
114 executions of commands named
115 .Pa a.out
116 by user
117 .Ar root
118 on the terminal
119 .Ar ttyd0 .
120 .Pp
121 For each process entry, the following are printed.
122 .Pp
123 .Bl -bullet -offset indent -compact
124 .It
125 The name of the user who ran the process.
126 .It
127 Flags, as accumulated by the accounting facilities in the system.
128 .It
129 The command name under which the process was called.
130 .It
131 The amount of
132 CPU
133 .Pq Fl c ,
134 wall
135 .Pq Fl e ,
136 system
137 .Pq Fl s ,
138 or user
139 .Pq Fl u
140 time used by the process (in seconds).
141 .It
142 The time the process started
143 .Pq Fl S
144 or exited
145 .Pq Fl E .
146 .El
147 .Pp
148 The flags are encoded as follows: ``S'' indicates the command was
149 executed by the super-user, ``F'' indicates the command ran after
150 a fork, but without a following
151 .Xr exec 3 ,
152 .\" ``C'' indicates the command was run in PDP-11 compatibility mode
153 .\" (VAX only),
154 ``D'' indicates the command terminated with the generation of a
155 .Pa core
156 file, and ``X'' indicates the command was terminated with a signal.
157 .Pp
158 By default, accounting entries are printed going backwards in time,
159 starting from the time
160 .Nm
161 was executed.
162 However, if
163 .Nm
164 reads entries from its standard input, then entries are printed in
165 the order they are read.
166 .Sh FILES
167 .Bl -tag -width /var/account/acct -compact
168 .It Pa /var/account/acct
169 default accounting file
170 .El
171 .Sh EXAMPLES
172 The command
173 .Dl lastcomm -Ee
174 will print the exit time and elapsed time of each command logged in
175 .Pa /var/account/acct ,
176 while
177 .Dl tail -f -c 0 /var/account/acct | lastcomm -f -
178 will print details of each terminating command.
179 .Sh SEE ALSO
180 .Xr last 1 ,
181 .Xr sigaction 2 ,
182 .Xr strftime 3 ,
183 .Xr acct 5 ,
184 .Xr core 5
185 .Sh HISTORY
186 The
187 .Nm
188 command appeared in
189 .Bx 3.0 .