Displays user and system login information.
The output is sorted by user ID, displaying system logins followed by user logins.
Item | Description |
---|---|
-a | In addition to the default output, the -a flag adds two password expiration fields to the display. These fields show how many days a password can remain unused before it automatically becomes inactive and the date that the password will expire. |
-g Groups | Displays all users belonging to group, sorted by user ID. Multiple groups can be specified as a comma separated list. Groups must specify valid group names on the system. Comma separate names when specifying more than one group. |
-l Logins | Displays the requested login. Multiple logins can be specified as a comma-separated list. Logins must specify valid user names on the system. |
-m | Displays multiple group membership information. |
-o | Formats output into one line of colon separated fields. |
-p | Displays users without passwords. |
-s | Displays all system logins. |
-t | Sorts output by user name instead of by user ID. |
-u | Displays all user logins. |
-x | Prints an extended set of information about
each selected user. Information for each user is printed on a separate
line containing the home directory, login shell, and password aging
information. The extended information includes the following:
|
logins -p
The
output looks similar to the following: pwdless 204 staff 1
nopwd 208 staff 1
The -p option
ensures that only logins with no passwords are listed.logins -st
The
output looks similar to the following: adm 4 adm 4
bin 2 bin 2
daemon 1 staff 1
lp 11 lp 11
lpd 9 nobody -2
root 0 system 0
sys 3 sys 3
uucp 5 uucp 5
The -t option
prints out the logins sorted alphabetically and not by uid.logins -l root,adm
The
output looks similar to the following: root 0 system 0
adm 4 adm 4
logins -xl root,adm
The output looks
similar to the following: root 0 system 0
/
/usr/bin/ksh
PS 021102 0 0 0
adm 4 adm 4
/var/adm
/sbin/sh
PS 000000 0 0 0
The -x option
ensures that extended password information for these logins are retrieved
and printed in the output.logins -mol root,adm
The
output looks similar to the following: root:0:system:0::bin:2:sys:3:security:7:cron:8:audit:10:lp:11
adm:4:adm:4:
The -m option is used here to retrieve
the multiple group information of a particular login (user). The -o option
ensures that the output is displayed in colon separated format.logins -tsog staff,sys
The
output looks similar to the following: bin:2:bin:2:
daemon:1:staff:1:
invscout:200:staff:1:
root:0:system:0:
sys:3:sys:3:
Item | Description |
---|---|
/usr/bin/logins | Contains the logins command. |
/etc/passwd | Contains the password file. |
/etc/group | Contains the group file. |