How To List All Users and Groups in Linux

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/list-users-groups-linux/
PINTEREST
PINTEREST
INSTAGRAM

Users and group files are important for Linux. Normal users will interact with Linux systems by using credentials provided in the user ad group file.

Print User File Named passwd

We can get content of the user file like below.  This file provides usernames home directories and shell information.

Print User File Named passwd
Print User File Named passwd

Print Only Usernames

We can print only usernames by filtering other columns like below.

Print Only Usernames
Print Only Usernames

Print Users Who Have Login

By default normal users will login to the Linux box. But in some cases service users do not need to login Linux system. This is also a security measure. We can list users who do not have login right with the following command. This login information is stored in the /etc/passwd file.

Print Users Who Have Login
Print Users Who Have Login

Print Users Who Have Home Directories

We can print only users who have home directories in /home. This command will first look in to the passwd to list users how have /home and then print only user names from result.

Print Users Who Have Home Directories
Print Users Who Have Home Directories

Print Group File

Linux users have primary and secondary groups. These group names are stored in the /etc/group file. We can print this group information and assigned user with cat command. For more details read following tutorial.

How To Add User To A Group In Linux

LEARN MORE  Which Groups Belong To A User In Linux

Print Group File
Print Group File

Print Only Group Names

We can print only group names by cutting other column like below.

Print Only Group Names
Print Only Group Names

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/list-users-groups-linux/
PINTEREST
PINTEREST
INSTAGRAM