List of users from command line

David Bandel david.bandel
Mon Jan 3 11:31:18 PST 2005


On Mon, 03 Jan 2005 10:20:15 -0500, Matthew Carpenter <matt at eisgr.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> # getent passwd

if you only want user accounts, and they're all between 500-999:
getent passwd | cut -f1,3 -d: - | grep [5-9].. - | cut -f1 -d: -
add -v to the grep to get system accounts

likewise, if your user accounts are 1000+ use:
getent passwd | cut -f1,3 -d: - | grep [1-9]... - | cut -f1 -d: -

The above can be refined even more, but that should give you the idea.

There are similar tricks to get lists of those with null passwords, etc.

> 
> This should work for virtually any form of authentication you use.  This
> has been tested and proven with compat, LDAP and Winbind
> Chong Yu Meng wrote:
> | Hi All,
> |
> | Another elementary question for the gurus on this list :
> |
> | I need to get a list of user accounts on a server, and though I know I
> | can probably do it using webmin or graphical tools, I am specifically
> | looking for a command that will do this for me. Can someone help?
> |
> | Thanks in Advance !

Ciao,

David A. Bandel
-- 
Focus on the dream, not the competition.
            - Nemesis Air Racing Team motto


More information about the Linux-users mailing list