Gabriel9999
Member
Iwant to list only users names in a Linux system byusing the /etc/passwd file.
Jinx!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!