Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How to list all users and groups on Linux?

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

share|improve this question
add comment

2 Answers

up vote 8 down vote accepted

getent(1)

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

share|improve this answer
add comment

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

share|improve this answer
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 at 15:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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