33
rated 0 times
[
33]
[
0]
/ answers: 1 / hits: 135191
/ 1 Year ago, fri, january 27, 2023, 2:09:47
How can I list all users along with their UIDs? I want to do this from the terminal.
More From » command-line
How can I list all users along with their UIDs? I want to do this from the terminal.
List all users with a /home
folder:
awk -F: '//home/ {printf "%s:%s
",$1,$3}' /etc/passwd
or all users with a UID >= 1000
:
awk -F: '($3 >= 1000) {printf "%s:%s
",$1,$3}' /etc/passwd
a combination
awk -F: '//home/ && ($3 >= 1000) {printf "%s:%s
",$1,$3}' /etc/passwd
or for all entries
awk -F: '{printf "%s:%s
",$1,$3}' /etc/passwd
More information here