{"id":2226,"date":"2020-11-30T11:30:02","date_gmt":"2020-11-30T11:30:02","guid":{"rendered":"https:\/\/linuxways.net\/?p=2226"},"modified":"2020-11-30T11:30:05","modified_gmt":"2020-11-30T11:30:05","slug":"how-to-list-users-in-linux","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/how-to-list-users-in-linux\/","title":{"rendered":"How to List Users in Linux"},"content":{"rendered":"<h2>Introduction:<\/h2>\n<p>Listing all the system users in Linux is considered a very important task of user management. By performing this task, you can easily know how many users are currently there on your system. With the help of this information, you can easily identify which of these users are legitimate and which users are not needed any longer. By identifying this, you can easily remove all those users that are not needed now so that they are not able to access your system anymore. <strong>Therefore, today we will learn all the methods of listing the users in Linux Mint 20. However, the very same methods can also be used on Debian 10 and Ubuntu 20.04.<\/strong><\/p>\n<h2>Methods of Listing Users in Linux Mint 20:<\/h2>\n<p>The methods of listing users in Linux Mint 20 can be categorized as the CLI-based methods and the GUI-based methods. Both types of methods have been explained below:<\/p>\n<h3>CLI-based Methods:<\/h3>\n<p>The two most common CLI-based methods of listing the users in Linux Mint 20 are as follows:<\/p>\n<h4>Method # 1: Using the \u201cgetent\u201d Command:<\/h4>\n<p>The \u201cgetent\u201d command is used to list all the users in Linux Mint 20 in the following manner:<\/p>\n<pre><strong>getent passwd | awk \u2013F: \u2018{ print $1}\u2019<\/strong><\/pre>\n<p>We can also use the simple \u201cgetnet passwd\u201d command, however, doing this will display lots of other information too which might not be relevant for you in the given context. That is why we have piped the output of the \u201cgetent passwd\u201d command to the \u201cawk\u201d command. This additional command is there to print only the information which is relevant for us i.e. the usernames of all the users.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"544\" height=\"28\" class=\"wp-image-2227\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-727.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-727.png 544w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-727-300x15.png 300w\" sizes=\"auto, (max-width: 544px) 100vw, 544px\" \/><\/p>\n<p>All the users of our Linux Mint 20 system are shown in the image below. In your case, you can use the scroll bar to view the entire user list.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"555\" height=\"412\" class=\"wp-image-2228\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-728.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-728.png 555w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-728-300x223.png 300w\" sizes=\"auto, (max-width: 555px) 100vw, 555px\" \/><\/p>\n<h4>Method # 2: Using the \u201c\/etc\/passwd\u201d File:<\/h4>\n<p>As the name implies, the \u201c\/etc\/passwd\u201d file stores the usernames and passwords of all your Linux system users. We can simply view the contents of this file to list down all the users of our Linux Mint 20 system in the following manner:<\/p>\n<pre><strong>awk \u2013F: \u2018{ print $1}\u2019 \/etc\/passwd<\/strong><\/pre>\n<p>Again, you can choose to display the entire contents of the \u201c\/etc\/passwd\u201d file which will essentially contain the following parameters: <strong>usernames<\/strong>, <strong>passwords<\/strong> (unencrypted since the encrypted passwords in Linux are always stored in the \/etc\/shadow file), <strong>User ID<\/strong> (UID), <strong>Group ID<\/strong> (GID<strong>), user\u2019s full name<\/strong>, <strong>login shell<\/strong>, and <strong>user\u2019s home directory<\/strong>. However, for this particular scenario, we are only concerned with the usernames of all the Linux Mint 20 users. That is why we have used the \u201cawk\u201d command instead of the \u201ccat\u201d command for displaying the contents of the \u201c\/etc\/passwd\u201d file so that we can only get the desired output.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"516\" height=\"23\" class=\"wp-image-2229\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-729.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-729.png 516w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-729-300x13.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-729-501x23.png 501w\" sizes=\"auto, (max-width: 516px) 100vw, 516px\" \/><\/p>\n<p>All the users of our Linux Mint 20 system are shown in the image below. In your case, you can use the scroll bar to view the entire user list.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"531\" height=\"413\" class=\"wp-image-2230\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-730.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-730.png 531w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-730-300x233.png 300w\" sizes=\"auto, (max-width: 531px) 100vw, 531px\" \/><\/p>\n<h3>GUI-based Method:<\/h3>\n<p>The most popular GUI-based method of listing the users in Linux Mint 20 is as follows:<\/p>\n<h4>Method # 3: Using the Users and Groups Utility:<\/h4>\n<p>The Users and Groups utility is a built-in utility of Linux-based systems. This utility displays the names of all the users and their groups. We can access it by first clicking on the Mint Menu icon as highlighted below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"240\" height=\"42\" class=\"wp-image-2231\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-731.png\" \/><\/p>\n<p>After launching the Mint Menu, just type users and groups in the search bar that appears on the screen and click on the Users and Groups search result.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-2232\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-732.png\" alt=\"How to List Users in Linux\" width=\"630\" height=\"473\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-732.png 630w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-732-300x225.png 300w\" sizes=\"auto, (max-width: 630px) 100vw, 630px\" \/><\/p>\n<p>When you will do this, you will be asked to authenticate yourself without which you will not be allowed to access this utility. Just provide your login password and click on the Authenticate button as highlighted in the following image:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-2233\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-733.png\" alt=\"How to List Users in Linux\" width=\"630\" height=\"264\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-733.png 630w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-733-300x126.png 300w\" sizes=\"auto, (max-width: 630px) 100vw, 630px\" \/><\/p>\n<p>As soon as you will authenticate yourself, you will be able to see the Users and Groups window on your screen. In its Users tab, you will see all the usernames as shown in the image below. You can also switch to the Groups tab to see all the user group names. Moreover, you can also add new users or even delete the existing users with the help of this utility.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-2234\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-734.png\" alt=\"How to List Users in Linux\" width=\"638\" height=\"505\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-734.png 638w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-734-300x237.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/11\/word-image-734-150x120.png 150w\" sizes=\"auto, (max-width: 638px) 100vw, 638px\" \/><\/p>\n<h2>Conclusion:<\/h2>\n<p>If you ever wish to list down all the Linux system users, you can pick any of the three methods that are discussed in this article. We have performed these methods on Linux Mint 20, however, they can also be used on Debian 10 or Ubuntu 20.04 with the very same level of convenience.<\/p>\n\n\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>Introduction: Listing all the system users in Linux is considered a very important task of user management. By performing this task, you can easily know how many users&hellip;<\/p>","protected":false},"author":3,"featured_media":2235,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,5,2],"tags":[17,45,89],"class_list":["post-2226","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-debian","category-mint","category-ubuntu","tag-debian-10","tag-linux-mint","tag-users"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/2226","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=2226"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/2226\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/2235"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=2226"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=2226"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=2226"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}