I want to display:
All users and
All groups
in my system using command-line.
users
and groups
commands display users currently logged in, and groups a user belongs to respectively.
How to display a list of all users and all groups by command-line?
getent passwd
/getent group
instead of cat'ing the local files (getent
should work for non-local accounts as well) – steeldriver Aug 23 '14 at 14:31compgen
does seem to work for non-local accounts (at least for LDAP). – muru Aug 23 '14 at 14:32cat /etc/passwd | cut -d ...
) – steeldriver Aug 23 '14 at 14:46999:999
asuser:group
, but unfortunately none of the above commands prints them. – Marinos An Mar 19 '19 at 11:31