The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]

Things look quiet here. But I've been doing a lot of blogging at dan.langille.org because I prefer WordPress now. Not all my posts there are FreeBSD related. I am in the midst of migrating The FreeBSD Diary over to WordPress (and you can read about that here). Once the migration is completed, I'll move the FreeBSD posts into the new FreeBSD Diary website.

Want a list of users on your box? 26 August 2000
Need more help on this topic? Click here
This article has 7 comments
Show me similar articles
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:

  • try the above command without the grep
  • remove the \ before the #
  • try -f5 instead of -f1.

Hope that helps.

My thanks to halflife for the original idea and to pal for adding the grep.


Share
Need more help on this topic? Click here
This article has 7 comments
Show me similar articles