Script to List All Users in /etc/passwd
February 19, 2014
This is a simple script to list all usernames in /etc/passwd.
#!/bin/bash PASSWORD_FILE=/etc/passwd n=1 for name in $(awk 'BEGIN{FS=":"}{print $1}' < "$PASSWORD_FILE" ) do echo "USER #$n = $name" let "n += 1" done exit 0