4

How to list all users and groups on Linux?

And what's the difference between user:root and user:othergroup?

8

getent(1)

user:root is a combination of user user and group root. user:othergroup is a combination of user user and group othergroup.

0

From the commandline, simply look at the files /etc/passwd and /etc/group. The information you look for is in the first column.

4
  • 1
    This will fail if something like LDAP is being used. – Ignacio Vazquez-Abrams May 10 '10 at 7:32
  • 4
    Worse, this will appear to work but will fail to show any accounts or groups that are not present in those files. – bignose May 10 '10 at 8:10
  • Agreed :-) I'm starting to feel my age ;-) – Aaron Digulla May 12 '10 at 20:54
  • If you have LDAP, looking at those files will not get all groups, on those cases, command "getent group" will. – kpraes Jan 14 '14 at 15:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.