This is the third and final part of the series. If you need a refresher, you can review the first part and the second part of the series. I recommend to also see "How to list information about users in Linux" tutorial.
Use any of the following commands to check if an user account exists on your Linux system:
$ compgen -u | grep desiredUser$ getent passwd desiredUser
If you want to know the number of the user accounts on your Linux system, you can use the wc
command, as in the example:
$ compgen -u | wc -l$ getent passwd | wc -l