How to display all user and groups by command

You can display with the help of compgen builtin command as follows:

To display all users run following command:

 compgen -u

To display all groups run following command:

compgen -g

Leave a Reply

Your email address will not be published. Required fields are marked *