{"id":4899,"date":"2023-07-22T09:35:34","date_gmt":"2023-07-22T09:35:34","guid":{"rendered":"https:\/\/arzhost.com\/blogs\/?p=4899"},"modified":"2025-09-16T16:19:39","modified_gmt":"2025-09-16T11:19:39","slug":"how-to-list-users-in-linux","status":"publish","type":"post","link":"https:\/\/arzhost.com\/blogs\/how-to-list-users-in-linux\/","title":{"rendered":"How to List Users In Linux The System awk Command"},"content":{"rendered":"\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_74 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/arzhost.com\/blogs\/how-to-list-users-in-linux\/#Introduction_Linux_Users_and_The_System_Awk_Command\" >Introduction: Linux Users and The System Awk Command<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/arzhost.com\/blogs\/how-to-list-users-in-linux\/#Listing_Users_in_Linux\" >Listing Users in Linux<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/arzhost.com\/blogs\/how-to-list-users-in-linux\/#Your_Remote_Office_Awaits_%E2%80%93_Sign_Up_Now_Save_Big_Today\" >Your Remote Office Awaits \u2013 Sign Up Now &amp; Save Big Today!<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/arzhost.com\/blogs\/how-to-list-users-in-linux\/#List_Users_with_cat_Command\" >List Users with cat Command<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/arzhost.com\/blogs\/how-to-list-users-in-linux\/#List_Users_with_Terminal_Pagers_less_and_more\" >List Users with Terminal Pagers less and more<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/arzhost.com\/blogs\/how-to-list-users-in-linux\/#List_Users_with_awk_Command\" >List Users with awk Command<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/arzhost.com\/blogs\/how-to-list-users-in-linux\/#List_Users_with_getent_Command\" >List Users with getent Command<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/arzhost.com\/blogs\/how-to-list-users-in-linux\/#Listing_Normal_and_System_users_in_Linux\" >Listing Normal and System users in Linux<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/arzhost.com\/blogs\/how-to-list-users-in-linux\/#Elevate_Your_WordPress_Site%E2%80%94Sign_Up_and_Save_Big\" >Elevate Your WordPress Site\u2014Sign Up and Save Big!<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/arzhost.com\/blogs\/how-to-list-users-in-linux\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Introduction_Linux_Users_and_The_System_Awk_Command\"><\/span>Introduction: Linux Users and The System Awk Command<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>An essential <a href=\"https:\/\/www.linux.com\/what-is-linux\/\" data-type=\"link\" data-id=\"https:\/\/www.linux.com\/what-is-linux\/\" target=\"_blank\" rel=\"noopener\"><strong>Linux system<\/strong><\/a> administration task is user management. Understanding How to List Users in Linux? who has access to the system is essential in large organizations to properly add users, remove users, and assign new user privileges.<\/p>\n\n\n\n<p>You will learn <span style=\"color: #000000;\"><strong>how to list users in Linux<\/strong><\/span>-based systems through this article from our <a href=\"https:\/\/arzhost.com\/blogs\/\"><strong>Blog<\/strong><\/a>. The manual outlines key user administration ideas and offers four listing ways.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>A system running Linux.<\/li>\n\n\n\n<li>Access to the terminal\/command line.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Listing_Users_in_Linux\"><\/span><strong>Listing Users in Linux<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Linux stores information about local users in the \/etc\/passwd file. Each line in the file contains information about a single user, including their <strong>username, user ID number (UID), home directory, and login shell<\/strong>.<\/p>\n\n\n\n<p>The following sections present multiple ways to access the data in \/etc\/passwd and list users on Linux distributions.<\/p>\n\n\n\n<p><u>How to List Users in Linux? The commands used in the tutorial are:<\/u><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>The cat command<\/code><\/li>\n\n\n\n<li><code>The less command<\/code><\/li>\n\n\n\n<li><code>The awk command<\/code><\/li>\n\n\n\n<li><code>The getent command<\/code><\/li>\n<\/ul>\n\n\n\n<div class=\"wp-block-uagb-call-to-action uagb-block-af73b687 wp-block-button uag-blocks-common-selector\" style=\"--z-index-desktop:479;;--z-index-tablet:undefined;;--z-index-mobile:undefined;\"><div class=\"uagb-cta__wrap\"><h2 class=\"uagb-cta__title\"><span class=\"ez-toc-section\" id=\"Your_Remote_Office_Awaits_%E2%80%93_Sign_Up_Now_Save_Big_Today\"><\/span><a href=\"https:\/\/arzhost.com\/rdps\/\" data-type=\"link\" data-id=\"https:\/\/arzhost.com\/rdps\/\">Your Remote Office Awaits \u2013 Sign Up Now &amp; Save Big Today!<\/a><span class=\"ez-toc-section-end\"><\/span><\/h2><p class=\"uagb-cta__desc\">Secure &amp; Fast Window VPS by <strong><a href=\"https:\/\/arzhost.com\/\" data-type=\"link\" data-id=\"https:\/\/arzhost.com\/\">ARZ Host<\/a><\/strong>\u2013 Start for Just $18\/month with Our Limited-Time Offer!<\/p><\/div><div class=\"uagb-cta__buttons\"><a href=\"https:\/\/arzhost.com\/rdps\/\" class=\"uagb-cta__button-link-wrapper wp-block-button__link\" target=\"_self\" rel=\"noopener noreferrer\">Read More<\/a><\/div><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"List_Users_with_cat_Command\"><\/span><strong>List Users with cat Command<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The cat command provides a straightforward way to list the contents of the \/etc\/passwd file.<\/p>\n\n\n\n<p><u>To view the file, type:<\/u><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>cat \/etc\/passwd<\/code><\/li>\n<\/ul>\n\n\n\n<p><u>The system outputs the entire file with all the users on the system. To view the number of users only, pipe the output of the previous command to the wc command and make it count the number of lines: <\/u><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>cat \/etc\/passwd | wc -l<\/code><\/li>\n<\/ul>\n\n\n\n<p>The number of lines in \/etc\/passwd corresponds to the total number of users.<\/p>\n\n\n\n<p><strong>Related Article: <a href=\"https:\/\/arzhost.com\/blogs\/linux-server-vs-windows-server\/\">Difference Between Linux Server vs Windows Server<\/a><\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"List_Users_with_Terminal_Pagers_less_and_more\"><\/span><strong>List Users with Terminal Pagers less and more<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>How to List Users in Linux? On systems with many users, it is useful to limit the \/etc\/passwd file output displayed at once. Use a terminal pager command, such as less or more, to browse through the file content line by line or page by page.<\/p>\n\n\n\n<p><u>To open \/etc\/passwd using less, enter:&nbsp; &nbsp;<\/u><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>less \/etc\/passwd<\/code><\/li>\n<\/ul>\n\n\n\n<p>The first page of the file appears in the output. The list stops when it reaches the end of the terminal screen. Use the keyboard to navigate through the file.<\/p>\n\n\n\n<p><u>Use more to get a similar result. This command is older and has a more limited set of functionalities:<\/u><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>more \/etc\/passwd<\/code><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"List_Users_with_awk_Command\"><\/span><strong>List Users with awk Command<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Use the awk command to list the usernames only, without additional information about each user.<\/p>\n\n\n\n<p><iframe title=\"YouTube video player\" src=\"https:\/\/www.youtube.com\/embed\/OLS9t1O6ihs\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n\n\n\n<p><u>Since the data fields in \/etc\/passwd are separated by a colon symbol, the following syntax tells awk to output only the first field in each line:<\/u><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>awk -F':' '{ print $1}' \/etc\/passwd<\/code><\/li>\n<\/ul>\n\n\n\n<p><u>Combine awk and less for a page-by-page view of the results.<\/u><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>awk -F':' '{ print $1}' \/etc\/passwd | less<\/code><\/li>\n<\/ul>\n\n\n\n<p>See our other articles like <a href=\"https:\/\/arzhost.com\/blogs\/how-to-show-hidden-files-in-linux\/\"><strong>Showing Hidden Files in Linux<\/strong><\/a> for a better understanding of how Linux works.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"List_Users_with_getent_Command\"><\/span><strong>List Users with getent Command<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>The getent command searches and displays system database entries. The searchable databases are listed in the \/etc\/nsswitch.conf file. By default, the file includes the passwd database.<\/p>\n\n\n\n<p><u>How to List Users in Linux? List the entire contents of the password database by typing:<\/u><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>getent passwd<\/code><\/li>\n<\/ul>\n\n\n\n<p><u>The output is the same as the output of the cat command. However, you can use getent to look up specific users. To do so, use the following syntax:<\/u><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>getent passwd [username]<\/code><\/li>\n<\/ul>\n\n\n\n<p>If the user exists on the system, the command shows the related passwd entry line.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Listing_Normal_and_System_users_in_Linux\"><\/span><strong>Listing Normal and System users in Linux<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><u>Linux-based systems have two types of users &#8211; system and normal users:<\/u><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>System users<\/strong> are entities formed by the system to carry out non-interactive procedures, i.e., background operations that don&#8217;t involve interacting with users. The most significant system user, root, has administrative rights.<\/li>\n\n\n\n<li><strong>Normal users<\/strong> are created by root or another user with root access. They are actual people. A login shell and a home directory for storing files are provided for every typical user.<\/li>\n<\/ol>\n\n\n\n<div class=\"wp-block-uagb-call-to-action uagb-block-aaa58f13 wp-block-button uag-blocks-common-selector\" style=\"--z-index-desktop:479;;--z-index-tablet:undefined;;--z-index-mobile:undefined;\"><div class=\"uagb-cta__wrap\"><h2 class=\"uagb-cta__title\"><span class=\"ez-toc-section\" id=\"Elevate_Your_WordPress_Site%E2%80%94Sign_Up_and_Save_Big\"><\/span><a href=\"https:\/\/arzhost.com\/wordpress-hosting\/\" data-type=\"link\" data-id=\"https:\/\/arzhost.com\/wordpress-hosting\/\">Elevate Your WordPress Site\u2014Sign Up and Save Big!<\/a><span class=\"ez-toc-section-end\"><\/span><\/h2><p class=\"uagb-cta__desc\">Optimized for WordPress\u2014Get Your Hosting Plan at just <strong>$0.99\/month!<\/strong><\/p><\/div><div class=\"uagb-cta__buttons\"><a href=\"https:\/\/arzhost.com\/wordpress-hosting\/\" class=\"uagb-cta__button-link-wrapper wp-block-button__link\" target=\"_self\" rel=\"noopener noreferrer\">Read More<\/a><\/div><\/div>\n\n\n\n<p>Linux assigns each user a unique user ID (UID) that serves as their identification. UIDs for system users vary from 0 (the root user) to 999. UIDs for regular users normally start at 1000, and the smallest unused UID is assigned to each newly created user.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"536\" title=\"elevate your wordpress site\" src=\"https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2025\/09\/elevate-your-wordpress-site-1024x536.jpg\" alt=\"elevate your wordpress site\" class=\"wp-image-13256\" srcset=\"https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2025\/09\/elevate-your-wordpress-site-1024x536.jpg 1024w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2025\/09\/elevate-your-wordpress-site-300x157.jpg 300w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2025\/09\/elevate-your-wordpress-site-768x402.jpg 768w, https:\/\/arzhost.com\/blogs\/wp-content\/uploads\/2025\/09\/elevate-your-wordpress-site.jpg 1200w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">elevate your wordpress site<\/figcaption><\/figure><\/div>\n\n\n<p><u>Use the grep command to look through the data kept in \/etc\/login and check the UID range for common users.def:<\/u><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>grep -E '^UID_MIN|^UID_MAX' \/etc\/login.defs<\/code><\/li>\n<\/ul>\n\n\n\n<p>How to List Users in Linux? The output in this example shows that the smallest UID a normal user can receive is 1000, and the largest is 60000. Wish to build your kernel? Read our detailed article <a href=\"https:\/\/arzhost.com\/blogs\/build-your-own-linux-kernel-from-scratch\/\"><strong>Build Your Own Linux Kernel from Scratch<\/strong><\/a>.<\/p>\n\n\n\n<p><u>Use getent to search the password database by UID:<\/u><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>getent passwd [UID]<\/code><\/li>\n<\/ul>\n\n\n\n<p>The output shows the user entry related to the UID.<\/p>\n\n\n\n<p><u>Use UIDs in combination with getent to search for users in a range:<\/u><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>getent passwd {[first-UID] ...[last-UID]}<\/code><\/li>\n<\/ul>\n\n\n\n<p>The command now lists all the users within the specified UID range.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span><strong>Conclusion<\/strong><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>This post demonstrated how to find the total number of Linux users in any Linux distribution, and how to List Users in Linux. and do a user search.<\/p>\n\n\n\n<p>Then, discover how to list scheduled cron jobs for specified users and Linux file permissions.<\/p>\n\n\n\n<p><strong>Read More:<\/strong><\/p>\n\n\n<ul class=\"wp-block-latest-posts__list wp-block-latest-posts\"><li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/arzhost.com\/blogs\/how-to-fix-403-forbidden-error-wordpress\/\">How To Fix 403 Forbidden Error WordPress<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/arzhost.com\/blogs\/how-to-get-the-most-out-of-claude-ai\/\">How To Get The Most Out Of Claude Ai<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/arzhost.com\/blogs\/bad-gateway-error-502-the-ultimate-guide-to-quick-fixes\/\">Bad Gateway Error (502): The Ultimate Guide to Quick Fixes<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/arzhost.com\/blogs\/a-deep-dive-into-todays-best-linux-distros\/\">A Deep Dive Into Today\u2019s Best Linux Distros<\/a><\/li>\n<li><a class=\"wp-block-latest-posts__post-title\" href=\"https:\/\/arzhost.com\/blogs\/domain-investor-terms-powerful-strategy\/\">Domain Investor Terms: Expert Insight on Powerful Strategy<\/a><\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>Introduction: Linux Users and The System Awk Command An essential Linux system administration task is user management. Understanding How to List Users in Linux? who has access to the system is essential in large organizations to properly add users, remove users, and assign new user privileges. You will learn how to list users in Linux-based [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":6110,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31],"tags":[],"table_tags":[],"class_list":["post-4899","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/posts\/4899","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/comments?post=4899"}],"version-history":[{"count":8,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/posts\/4899\/revisions"}],"predecessor-version":[{"id":13257,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/posts\/4899\/revisions\/13257"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/media\/6110"}],"wp:attachment":[{"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/media?parent=4899"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/categories?post=4899"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/tags?post=4899"},{"taxonomy":"table_tags","embeddable":true,"href":"https:\/\/arzhost.com\/blogs\/wp-json\/wp\/v2\/table_tags?post=4899"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}