show users linux code example
Example 1: list users in linux
cat /etc/passwd
Example 2: how to see our already added users in linux
$ lslogins -u
UID USER PROC PWD-LOCK PWD-DENY LAST-LOGIN GECOS
0 root 144 root
1000 tecmint 70 10:39:07 TecMint,,,
1001 aaronkilik 0
1002 john 0 John Doo
Example 3: list all users linux
awk -F: '{ print $1}' /etc/passwd
Example 4: users list linux
cut -d: -f1 /etc/passwd
or
cat /etc/passwd
Example 5: get users shell
getent passwd $LOGNAME | cut -d: -f7