Monday, May 27, 2013

How to list all users in Linux


To list only usernames type the following awk command.

awk -F':' '{ print $1}' /etc/passwd


Eg:

[root@jbsvr u01]#   awk -F':' '{ print $1}' /etc/passwd

root
bin
daemon
adm
lp
sync
shutdown
halt
mail
news
uucp
operator
games
gopher
ftp
nobody
rpm
dbus
nscd
vcsa
pcap
rpc
mailnull
smmsp
sshd
rpcuser
nfsnobody
haldaemon
avahi
apache
ntp
xfs
gdm
sabayon
jboss
jbtest
apacheds
avahi-autoipd
oprofile
exim
oracle
orafin
amandabackup