How to list all users in Linux - part 3

The context

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.

Further checks on user accounts

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

Other articles:

How to create users in Linux

How to delete users in Linux

How to create user groups in Linux

How to delete user groups in Linux