List Only Usernames



My quickest way is
awk -F ':" '{print $1}' /etc/passwd

if you want to sort it by name add | sort -k 1, so
awk -F ':' '{print $1}' /etc/passwd | sort -k 1

or even reverse search
awk -F ':' '{print $1}' /etc/passwd | sort -r -k 1.

Hope that helps!
 
My quickest way is
awk -F ':" '{print $1}' /etc/passwd

if you want to sort it by name add | sort -k 1, so
awk -F ':' '{print $1}' /etc/passwd | sort -k 1

or even reverse search
awk -F ':' '{print $1}' /etc/passwd | sort -r -k 1.

Hope that helps!
Jinx!
I was just about to post pretty much exactly the same solution!
You beat me to it by a few seconds!
 
My quickest way is
awk -F ':" '{print $1}' /etc/passwd

if you want to sort it by name add | sort -k 1, so
awk -F ':' '{print $1}' /etc/passwd | sort -k 1

or even reverse search
awk -F ':' '{print $1}' /etc/passwd | sort -r -k 1.

Hope that helps!


I did think of one more thing for people not used to Linux - USUALLY human users are higher than a specified userid (500, 1000, etc.) so you can sort by userid then look only at the last /highest userid users.

sort -t ':' -k 3 -n /etc/passwd | awk -F ':' '{print $1 " " $3}'
 

Members online


Top