The FreeBSD Diary
Providing practical examples since 1998If you buy from Amazon USA, please support us by using this link.
Want a list of users on your box? 26 August 2000
If you ever want a list of users on your system, use this little script:
cat /etc/passwd | cut -d: -f1 | grep -v \#
The cut command selects portions of a file. We use ":" as the delimiting character. And we want only the first field. The grep eliminates lines with # in them, which normally appear at the start of the password file.
Exercises for the interested and motivated:
Hope that helps.
My thanks to halflife for the original idea and to pal for adding the grep.