[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home |
Legal |
Search ]
Commands Reference, Volume 3
logins Command
Purpose
Displays user and system login information
Syntax
logins [ -a ] [ -m ]
[ -o ] [ -p ] [ -s ] [ -t ]
[ -u ] [ -x ] [ -g Groups ] [ -l Logins ]
Description
The logins command displays information about user
and system logins. By default, the logins command prints
the following:
- Userr ID
- primary group name
- primary group ID
- the /etc/passwd account field on user information.
The output is sorted by user ID, displaying system logins followed by user
logins.
Depending on the options chosen, the following fields can also be displayed:
- user or system login
- user ID number
- multiple group names
- multiple group IDs
- home directory
- login shell
- four password aging parameters
- /etc/passwd account field value (user name or other information)
- primary group name
- primary group ID
Flags
-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:
- The password status
- The date on which the password was last changed
- The number of days required between changes
- The number of days allowed before a change is needed
- The number of days that the user will receive a password expiration warning
message before the password expires
The password status is displayed in an abbreviated form as PS for
logins with password, NP for no password or LK for locked. |
Exit Status
- 0
- The command completed successfully.
- >0
- An error occurred.
Examples
- To list all the logins with no passwords, enter:
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.
- To list all the system logins sorted by alphabetical order enter:
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.
- To list the login details of users "root' and "admin", enter:
logins -l root,adm
The output looks similar to the following:
root 0 system 0
adm 4 adm 4
- To list the password aging details of users "root" and "admin" enter:
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.
- To display the multiple group information of a particular user in a colon
separated format enter:
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.
- To display the users of the "staff" and "sys" groups in a colon separated
format, sorted by user name, enter:
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:
Files
/usr/bin/logins |
Contains the logins command. |
/etc/passwd |
Contains the password file. |
/etc/group |
Contains the group file. |
Related Information
The lsuser command, the lsgroup command.
[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home |
Legal |
Search ]