[LBo] Re: Re: How to let the system display number of users and groups?

Jan jvdstaaij at chello.nl
Fri Nov 3 17:54:36 CET 2006


Billy Pollifrone wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Tim Cruikshank wrote:
>> 
>> Close, I was actually referring to cat -b instead of cat -n.
>> -n numbers all lines including blank ones, whereas -b only numbers
>> non-blank lines. Since it is possible that /etc/passwd could contain
>> blank lines -n could give you a false report of the number of users.
>> 
>> Another way to achieve the desired result would be to use wc.
>> 
>> $cat /etc/passwd | wc -l
>> 
> 
> The question didn't ask this, but if you ever wanted to know the number
> of users that don't include users to run services you could use a recipe
> like:
> 
> cat /etc/password | grep :\/home | grep -v \/bin\/false | wc -l
> 
> It doesn't answer the question, but shows you than there are countless
> other ideas that you can use to brew up crafty stuff using built-in tools.
> 
> - --
> Billy Pollifrone

Thanks guys!

Jan



More information about the QnA mailing list