1LSLOGINS(1) User Commands LSLOGINS(1)
2
3
4
6 lslogins - display information about known users in the system
7
9 lslogins [options] [-s|-u[=UID]] [-g groups] [-l logins] [username]
10
12 Examine the wtmp and btmp logs, /etc/shadow (if necessary) and /passwd
13 and output the desired data.
14
15 The optional argument username forces lslogins to print all available
16 details about the specified user only. In this case the output format
17 is different than in case of -l or -g and unknown is username reported
18 as an error.
19
20 The default action is to list info about all the users in the system.
21
23 Mandatory arguments to long options are mandatory for short options
24 too.
25
26 -a, --acc-expiration
27 Display data about the date of last password change and the account
28 expiration date (see shadow(5) for more info). (Requires root
29 privileges.)
30
31 --btmp-file path
32 Alternate path for btmp.
33
34 -c, --colon-separate
35 Separate info about each user with a colon instead of a newline.
36
37 -e, --export
38 Output data in the format of NAME=VALUE. See also option --shell.
39
40 -f, --failed
41 Display data about the users' last failed login attempts.
42
43 -G, --supp-groups
44 Show information about supplementary groups.
45
46 -g, --groups=groups
47 Only show data of users belonging to groups. More than one group
48 may be specified; the list has to be comma-separated. Unknown group
49 names are ignored.
50
51 Note that the relation between user and group may be invisible for
52 the primary group if the user is not explicitly specified as group
53 member (e.g., in /etc/group). If the command lslogins scans for
54 groups then it uses the groups database only, and the user database
55 with primary GID is not used at all.
56
57 -L, --last
58 Display data containing information about the users' last login
59 sessions.
60
61 -l, --logins=logins
62 Only show data of users with a login specified in logins (user
63 names or user IDs). More than one login may be specified; the list
64 has to be comma-separated. Unknown login names are ignored.
65
66 -n, --newline
67 Display each piece of information on a separate line.
68
69 --noheadings
70 Do not print a header line.
71
72 --notruncate
73 Don’t truncate output.
74
75 -o, --output list
76 Specify which output columns to print. The default list of columns
77 may be extended if list is specified in the format +list.
78
79 --output-all
80 Output all available columns. --help to get a list of all supported
81 columns.
82
83 -p, --pwd
84 Display information related to login by password (see also -afL).
85
86 -r, --raw
87 Raw output (no columnation).
88
89 -s, --system-accs
90 Show system accounts. These are by default all accounts with a UID
91 between 101 and 999 (inclusive), with the exception of either
92 nobody or nfsnobody (UID 65534). This hardcoded default may be
93 overwritten by parameters SYS_UID_MIN and SYS_UID_MAX in the file
94 /etc/login.defs.
95
96 --time-format type
97 Display dates in short, full or iso format. The default is short,
98 this time format is designed to be space efficient and human
99 readable.
100
101 -u, --user-accs
102 Show user accounts. These are by default all accounts with UID
103 above 1000 (inclusive), with the exception of either nobody or
104 nfsnobody (UID 65534). This hardcoded default maybe overwritten by
105 parameters UID_MIN and UID_MAX in the file /etc/login.defs.
106
107 -h, --help
108 Display help text and exit.
109
110 -V, --version
111 Print version and exit.
112
113 --wtmp-file path
114 Alternate path for wtmp.
115
116 --lastlog path
117 Alternate path for lastlog(8).
118
119 y-, --shell
120 The column name will be modified to contain only characters allowed
121 for shell variable identifiers. This is usable, for example, with
122 --export. Note that this feature has been automatically enabled for
123 --export in version 2.37, but due to compatibility issues, now it’s
124 necessary to request this behavior by --shell.
125
126 -Z, --context
127 Display the users' security context.
128
129 -z, --print0
130 Delimit user entries with a nul character, instead of a newline.
131
133 0
134 if OK,
135
136 1
137 if incorrect arguments specified,
138
139 2
140 if a serious error occurs (e.g., a corrupt log).
141
143 The default UID thresholds are read from /etc/login.defs.
144
146 The lslogins utility is inspired by the logins utility, which first
147 appeared in FreeBSD 4.10.
148
150 Ondrej Oprala <ooprala@redhat.com>, Karel Zak <kzak@redhat.com>
151
153 group(5), passwd(5), shadow(5), utmp(5)
154
156 For bug reports, use the issue tracker at
157 https://github.com/util-linux/util-linux/issues.
158
160 The lslogins command is part of the util-linux package which can be
161 downloaded from Linux Kernel Archive
162 <https://www.kernel.org/pub/linux/utils/util-linux/>.
163
164
165
166util-linux 2.38.1 2022-05-11 LSLOGINS(1)