How to List Users in Linux Mint 21?


We all understand that a Linux system or any other operating system can be used by multiple users at once. At times, the system administrator wishes to find out all the users who have the access to given a Linux system. Therefore, this tutorial will show you some methods with which you can list down all the users of a Linux Mint 21 system.

Ways of Listing the Users in Linux Mint 21:

To list down all the users of a Linux Mint 21 system, you can use any of the following four methods:

Method # 1: With the Help of the “cat” Command:

The “cat” command can be used to list down all the users of a Linux Mint 21 system in the manner shown below:

$ cat /etc/passwd

This command will display the names of all the users along with some other associated information from the “/etc/passwd” file as shown in the following image:

How-List-Users

Method # 2: With the Help of the “getent” Command:

You can also use the “getent” command to list down the users with the command given below:

$ getent passwd

This command will also display other relevant information along with usernames as shown in the following image:

How-List-Users

Method # 3: With the Help of the “awk” Command:

If you wish to trim the output from the above two methods to only display usernames, then you will have to use the command shown below:

$ awk –F: ‘{ print $1 }’ /etc/passwd

The above-mentioned command will only display the names of the users as shown in the following image:

How-List-Users

Method # 4: With the Help of “compgen” Command:

This method will render pretty much similar output as our third method. The command used for this method is stated below:

$ compgen –u

All the users of our Linux Mint 21 system are shown in the following image:

How-List-Users

Conclusion:

This article discussed the four methods of listing down all the users of a Linux Mint 21 system. If you wish to display additional information along with the usernames, then you can use any of the first two methods. Otherwise, if you only want to display the usernames, then you can use either of the last two methods.

Print Friendly, PDF & Email
Categories