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 groupinstead of cat'ing the local files (getentshould work for non-local accounts as well) – steeldriver Aug 23 '14 at 14:31compgendoes 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:999asuser:group, but unfortunately none of the above commands prints them. – Marinos An Mar 19 '19 at 11:31compgenis for "completion generation", to generate and display possible completions depending on the options. It can be used to complete many things, like filenames if using-for-f my-fi. The-uis for completing usernames, and if you leave it blank, it displays all of them. – KeitelDOG Apr 21 '24 at 17:49