{"id":24009,"date":"2024-01-31T13:20:21","date_gmt":"2024-01-31T13:20:21","guid":{"rendered":"https:\/\/linuxways.net\/?p=24009"},"modified":"2024-01-31T13:26:24","modified_gmt":"2024-01-31T13:26:24","slug":"list-users-debian-12","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/debian\/list-users-debian-12\/","title":{"rendered":"How to List Users in Debian 12"},"content":{"rendered":"<p>User management is one of the important duties of the system administrator that helps you keep the system secure and organized. Debian is a multiple-user operating system and each user has its own set of permissions and privileges. To ensure the system&#8217;s privacy and prevent unauthorized access, the administrator must know the information of every user and manage them wisely.<\/p>\n<p>This guide aims to learn two approaches for listing the users in the Debian 12 that will help you manage multiple users on your system easily.<\/p>\n<h2><strong>Quick Outline<\/strong><\/h2>\n<ul>\n<li><a href=\"#post-24009-_66facinnr8q4\"><strong>How to List All Users in Debian 12<\/strong><\/a><\/li>\n<li><a href=\"#post-24009-_1nc1qw2paqs0\"><strong>How to View Current Login Users in Debian 12<\/strong><\/a><\/li>\n<li><a href=\"#post-24009-_30svwmydxb1\"><strong>Conclusion<\/strong><\/a><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h1><a id=\"post-24009-_66facinnr8q4\"><\/a><strong>How to List All Users in Debian 12<\/strong><\/h1>\n<p>The are two ways to list users in Debian 12:<\/p>\n<ul>\n<li><a href=\"#post-24009-_6eecs1l2zfpy\"><strong>Through Terminal<\/strong><\/a><\/li>\n<li><a href=\"#post-24009-_kvqafwyengyz\"><strong>Through GUI<\/strong><\/a><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h2><a id=\"post-24009-_6eecs1l2zfpy\"><\/a><strong>How to List Users in Debian 12 Through Terminal<\/strong><\/h2>\n<p>Below we have listed the various commands to list users in Debian 12:<\/p>\n<ul>\n<li><a href=\"#post-24009-gz6oumr0iap3\"><strong>List Users Using cat Command<\/strong><\/a><\/li>\n<li><a href=\"#post-24009-2ejnxjwxrok0\"><strong>List Users Using awk Command<\/strong><\/a><\/li>\n<li><a href=\"#post-24009-q94emo9lkbq8\"><strong>List Users Using getnet Command<\/strong><\/a><\/li>\n<li><a href=\"#post-24009-kix.4o2g605asra4\"><strong>List Users Using compgen Command<\/strong><\/a><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h2><strong>How to List Users Using cat Command in Debian 12<\/strong><\/h2>\n<p>The <strong>cat command<\/strong> in Debian is widely used to display the content of files quickly. You can preview the information of users in Debian by viewing these two files:<\/p>\n<ul>\n<li><a href=\"#post-24009-sh1twvx94ktx\"><strong>\/etc\/passwd File<\/strong><\/a><\/li>\n<li><a href=\"#post-24009-137gticv1djv\"><strong>\/etc\/shadow File<\/strong><\/a><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h3><strong>1: Use cat Command to View List of Users in the \u2018\/etc\/passwd\u2019 File in Debian 12<\/strong><\/h3>\n<p>The information of each local user account is stored in the <strong>\/etc\/passwd<\/strong> file in Debian 12. You can display this information inside this file using the <strong>cat <\/strong>command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">cat<\/span> <span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span><span class=\"kw2\">passwd<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"738\" height=\"447\" class=\"wp-image-24048\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-1.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-1.png 738w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-1-300x182.png 300w\" sizes=\"auto, (max-width: 738px) 100vw, 738px\" \/><\/p>\n<p>The above command will display the information of each user; the information consists of multiple fields separated by the colon as shown below:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\">User Name : Password : <span class=\"sy0\">&lt;<\/span>strong<span class=\"sy0\">&gt;<\/span>UID <span class=\"sy0\">&lt;\/<\/span>strong<span class=\"sy0\">&gt;<\/span><span class=\"br0\">&#40;<\/span>User Identification<span class=\"br0\">&#41;<\/span> <span class=\"sy0\">&lt;<\/span>strong<span class=\"sy0\">&gt;<\/span>: GID <span class=\"sy0\">&lt;\/<\/span>strong<span class=\"sy0\">&gt;<\/span><span class=\"br0\">&#40;<\/span>User Group ID<span class=\"br0\">&#41;<\/span> <span class=\"sy0\">&lt;<\/span>strong<span class=\"sy0\">&gt;<\/span>: Full<span class=\"sy0\">&lt;\/<\/span>strong<span class=\"sy0\">&gt;<\/span> <span class=\"sy0\">&lt;<\/span>strong<span class=\"sy0\">&gt;<\/span>Name :<span class=\"sy0\">&lt;\/<\/span>strong<span class=\"sy0\">&gt;<\/span> <span class=\"sy0\">&lt;<\/span>strong<span class=\"sy0\">&gt;<\/span>Home Directory : Shell Used<\/div><\/div>\n<p>Here:<\/strong><\/p>\n<p>1: The <strong>User Name <\/strong>is the login name of the user.<\/p>\n<p>2: The next field is the encrypted password and<strong> x <\/strong>represents that the password is stored in the <strong>\/etc\/shadow<\/strong> file.<\/p>\n<p>3: Next to the password is <strong>UID,<\/strong> <strong>GID<\/strong>, the <strong>Full Name<\/strong> of the user, and its <strong>home directory<\/strong>.<\/p>\n<p>4: The last field represents the login shell and that is the default <strong>\/bin\/bash.<\/strong><\/p>\n<p>You can also use <strong>less<\/strong> or <strong>more <\/strong>commands to customize the output. These commands are used to view the content of large files interactively as you can easily browse through them.<\/p>\n<p>The <strong>less command <\/strong>shows the file in separate sections or pages and provides the navigation.<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">less<\/span> <span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span><span class=\"kw2\">passwd<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"722\" height=\"447\" class=\"wp-image-24063\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-2.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-2.png 722w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-2-300x186.png 300w\" sizes=\"auto, (max-width: 722px) 100vw, 722px\" \/><\/p>\n<p>The <strong>more command<\/strong> will display one page of the file at a time:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">more<\/span> <span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span><span class=\"kw2\">passwd<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"712\" height=\"447\" class=\"wp-image-24079\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-3.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-3.png 712w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-3-300x188.png 300w\" sizes=\"auto, (max-width: 712px) 100vw, 712px\" \/><\/p>\n<p>You can use various flags with the cat command to customize the output, such as:<\/p>\n<ul>\n<li><a href=\"#post-24009-7hb6usls8xzh\"><strong>Get Only Username in Debian 12<\/strong><\/a><\/li>\n<li><a href=\"#post-24009-jcpv161h3pmz\"><strong>Get the Total Number of Users in Debian 12<\/strong><\/a><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><strong>1: Get Only Usernames in Debian 12 <\/strong><\/p>\n<p>Execute the following cat command to view only the list of usernames in Debian 12:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">cat<\/span> <span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span><span class=\"kw2\">passwd<\/span> <span class=\"sy0\">|<\/span> <span class=\"kw2\">cut<\/span> -d: <span class=\"re5\">-f1<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"688\" height=\"449\" class=\"wp-image-24092\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-4.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-4.png 688w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-4-300x196.png 300w\" sizes=\"auto, (max-width: 688px) 100vw, 688px\" \/><\/p>\n<p>Moreover, you can also use the <strong>cut command <\/strong>to display the only names of the users:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">cut<\/span> -d: <span class=\"re5\">-f1<\/span> <span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span><span class=\"kw2\">passwd<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"711\" height=\"449\" class=\"wp-image-24108\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-5.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-5.png 711w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-5-300x189.png 300w\" sizes=\"auto, (max-width: 711px) 100vw, 711px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><strong>2: Get the Total Number of Users in Debian 12<\/strong><\/p>\n<p>To get only the total number of users on Debian, run the following cat command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">cat<\/span> <span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span><span class=\"kw2\">passwd<\/span> <span class=\"sy0\">|<\/span> <span class=\"kw2\">wc<\/span> <span class=\"re5\">-l<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"726\" height=\"139\" class=\"wp-image-24114\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-6.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-6.png 726w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-6-300x57.png 300w\" sizes=\"auto, (max-width: 726px) 100vw, 726px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h3><strong>2: Use cat Command to View List of Users in \/etc\/shadow File in Debian 12<\/strong><\/h3>\n<p>The<strong> \/etc\/shadow<\/strong> file stores the password hashes and other password related information of the user accounts. You can use the cat command followed by the shadow file location to retrieve the list of users in Debian 12:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">sudo<\/span> <span class=\"kw2\">cat<\/span> <span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span>shadow<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"793\" height=\"449\" class=\"wp-image-24123\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-7.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-7.png 793w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-7-300x170.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-7-768x435.png 768w\" sizes=\"auto, (max-width: 793px) 100vw, 793px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2><strong>2: How to List Users Using awk Command in Debian 12<\/strong><\/h2>\n<p>The other command used to display only the name of the users is the <strong>awk command<\/strong>. The <strong>awk<\/strong> is the command line utility that interprets the information from the <strong>\/etc\/passwd <\/strong>file similar to the <strong>cat command<\/strong>.<\/p>\n<p>When you execute this command, the list of all the users will appear on your screen:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">awk<\/span> <span class=\"re5\">-F<\/span><span class=\"st_h\">':'<\/span> <span class=\"st_h\">'{ print $1}'<\/span> <span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span><span class=\"kw2\">passwd<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"672\" height=\"449\" class=\"wp-image-24130\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-8.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-8.png 672w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-8-300x200.png 300w\" sizes=\"auto, (max-width: 672px) 100vw, 672px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2><strong>3: How to List Users Using getnet Command in Debian 12<\/strong><\/h2>\n<p>In Linux, <strong>getnet<\/strong> is a common way to get the user information. It includes the passwd and group databases that store the information and displays the database configured in <strong>\/etc\/nsswitch.conf <\/strong>file. You can use the <strong>getnet command<\/strong> in Debian 12 to:<\/p>\n<ul>\n<li><a href=\"#post-24009-npruq3u8xluk\"><strong>Get the Details of All Users<\/strong><\/a><\/li>\n<li><a href=\"#post-24009-t4axs1x0t06s\"><strong>Display Only Name of Users<\/strong><\/a><\/li>\n<li><a href=\"#post-24009-jg79l1yog0xc\"><strong>Check the Existence of Specific User<\/strong><\/a><\/li>\n<li><a href=\"#post-24009-nejipygseq9q\"><strong>Display Regular Users<\/strong><\/a><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h3><strong>1: Get the Details of All Users <\/strong><\/h3>\n<p>To get the detailed information of all users using <strong>getnet<\/strong> in Debian 12, execute the following command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">getent<\/span> <span class=\"kw2\">passwd<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"736\" height=\"449\" class=\"wp-image-24142\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-9.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-9.png 736w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-9-300x183.png 300w\" sizes=\"auto, (max-width: 736px) 100vw, 736px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h3><strong>2: Display Only Name of Users <\/strong><\/h3>\n<p>You can limit the output by executing the below-given command to get only the names of users on Debian:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">getent<\/span> <span class=\"kw2\">passwd<\/span> <span class=\"sy0\">|<\/span> <span class=\"kw2\">awk<\/span> -F: <span class=\"st_h\">'{ print $1}'<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"685\" height=\"446\" class=\"wp-image-24147\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-10.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-10.png 685w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-10-300x195.png 300w\" sizes=\"auto, (max-width: 685px) 100vw, 685px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h3><strong>3: Check the Existence of Specific User<\/strong><\/h3>\n<p>You can use the <strong>getnet <\/strong>command to view the information of specific users in Debian, it can be done using:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">getent<\/span> <span class=\"kw2\">passwd<\/span> <span class=\"sy0\">&lt;<\/span>name<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"761\" height=\"150\" class=\"wp-image-24151\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-11.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-11.png 761w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-11-300x59.png 300w\" sizes=\"auto, (max-width: 761px) 100vw, 761px\" \/><\/p>\n<p>Here, in place of <strong>&lt;name&gt;<\/strong> specify your username.<\/p>\n<p>You can also use the <strong>grep command<\/strong> with <strong>getnet<\/strong> to display the user information in Debian:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">getent<\/span> <span class=\"kw2\">passwd<\/span> <span class=\"sy0\">|<\/span> <span class=\"kw2\">grep<\/span> <span class=\"sy0\">&lt;<\/span>name<span class=\"sy0\">&gt;<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"750\" height=\"129\" class=\"wp-image-24156\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-12.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-12.png 750w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-12-300x52.png 300w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h3><strong>4: Display Regular Users<\/strong><\/h3>\n<p>In Linux, there are two types of users: system users and regular users. The <strong>system user <\/strong>is created while installing the OS and the <strong>regular user<\/strong> is created by the user who has sudo privileges. The regular user has a home directory. You can use <strong>UIDs <\/strong>to search users in the specific range using the following syntax:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">getent<\/span> <span class=\"kw2\">passwd<\/span> <span class=\"br0\">&#123;<\/span><span class=\"br0\">&#91;<\/span>first-UID<span class=\"br0\">&#93;<\/span>..<span class=\"br0\">&#91;<\/span>last-UID<span class=\"br0\">&#93;<\/span><span class=\"br0\">&#125;<\/span><\/div><\/div>\n<p>To get the minimum and maximum value of the user ID execute the following command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">grep<\/span> <span class=\"re5\">-E<\/span> <span class=\"st_h\">'^UID_MIN|^UID_MAX'<\/span> <span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span>login.defs<\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"771\" height=\"114\" class=\"wp-image-24161\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-13.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-13.png 771w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-13-300x44.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-13-768x114.png 768w\" sizes=\"auto, (max-width: 771px) 100vw, 771px\" \/><\/p>\n<p>To display only the<strong> regular users <\/strong>in Debian 12, execute the following command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">getent<\/span> <span class=\"kw2\">passwd<\/span> <span class=\"br0\">&#123;<\/span><span class=\"nu0\">1000<\/span>..<span class=\"nu0\">60000<\/span><span class=\"br0\">&#125;<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"753\" height=\"192\" class=\"wp-image-24167\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-14.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-14.png 753w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-14-300x76.png 300w\" sizes=\"auto, (max-width: 753px) 100vw, 753px\" \/><\/p>\n<p>The range in the above command is the range of user IDs of regular users in Debian. To print only usernames you can also execute the below command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw3\">eval<\/span> <span class=\"kw2\">getent<\/span> <span class=\"kw2\">passwd<\/span> <span class=\"br0\">&#123;<\/span>$<span class=\"br0\">&#40;<\/span><span class=\"kw2\">awk<\/span> <span class=\"st_h\">'\/^UID_MIN\/ {print $2}'<\/span> <span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span>login.defs<span class=\"br0\">&#41;<\/span>..$<span class=\"br0\">&#40;<\/span><span class=\"kw2\">awk<\/span> <span class=\"st_h\">'\/^UID_MAX\/ {print $2}'<\/span> <span class=\"sy0\">\/<\/span>etc<span class=\"sy0\">\/<\/span>login.defs<span class=\"br0\">&#41;<\/span><span class=\"br0\">&#125;<\/span> <span class=\"sy0\">|<\/span> <span class=\"kw2\">cut<\/span> -d: <span class=\"re5\">-f1<\/span><\/div><\/div>\n<h3><strong>4: <\/strong><a id=\"post-24009-kix.4o2g605asra4\"><\/a><strong>How to List Users Using compgen Command in Debian 12<\/strong><\/h3>\n<p>The <strong>compgen <\/strong>is the bash built-in command of Linux that can be used with different options to get information. When you use this command with the<strong> -u<\/strong> flag, it displays the list of all users in Debian:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw3\">compgen<\/span> <span class=\"re5\">-u<\/span><\/div><\/div>\n<h2><a id=\"post-24009-_kvqafwyengyz\"><\/a><strong>How to List Users in Debian 12 Through GUI<\/strong><\/h2>\n<p>Another approach for listing <strong>regular users<\/strong> in Debian is through the system settings and to do so follow these steps:<\/p>\n<p><strong>Step 1: <\/strong>Navigate to <strong>Activities <\/strong>and search for <strong>Settings <\/strong>to open the System <strong>Settings<\/strong>:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"721\" height=\"485\" class=\"wp-image-24174\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-16.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-16.png 721w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-16-300x202.png 300w\" sizes=\"auto, (max-width: 721px) 100vw, 721px\" \/><\/p>\n<p><strong>Step 2: <\/strong>Next, click on <strong>Users <\/strong>from the left panel:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"795\" height=\"487\" class=\"wp-image-24179\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-17.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-17.png 795w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-17-300x184.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-17-768x470.png 768w\" sizes=\"auto, (max-width: 795px) 100vw, 795px\" \/><\/p>\n<p><strong>Step 3: <\/strong>Click on the <strong>Unlock<\/strong> button that appears at the top of the screen to unlock the user settings:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"787\" height=\"486\" class=\"wp-image-24181\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-18.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-18.png 787w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-18-300x185.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-18-768x474.png 768w\" sizes=\"auto, (max-width: 787px) 100vw, 787px\" \/><\/p>\n<p><strong>Step 4: <\/strong>A prompt will appear on the screen, asking you to enter the password of the <strong>Administrator <\/strong>account; type the password and click on<strong> Authenticate<\/strong> button to continue:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"706\" height=\"482\" class=\"wp-image-24185\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-19.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-19.png 706w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-19-300x205.png 300w\" sizes=\"auto, (max-width: 706px) 100vw, 706px\" \/><\/p>\n<p><strong>Step 5: <\/strong>Scroll down and you will find the list of users under <strong>Other Users; <\/strong>here you can add another user, modify the information of existing users, and also remove the user from the system:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"789\" height=\"471\" class=\"wp-image-24186\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-20.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-20.png 789w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-20-300x179.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-20-768x458.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-20-501x300.png 501w\" sizes=\"auto, (max-width: 789px) 100vw, 789px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2><a id=\"post-24009-_1nc1qw2paqs0\"><\/a><strong>How to View Current Login Users in Debian 12<\/strong><\/h2>\n<p>To get the list of all the connected users in Debian 12, you can execute the following command:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">who<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"742\" height=\"155\" class=\"wp-image-24188\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-21.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-21.png 742w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-21-300x63.png 300w\" sizes=\"auto, (max-width: 742px) 100vw, 742px\" \/><\/p>\n<p>The below command also displays the names of the current users:<\/p>\n<div class=\"codecolorer-container bash blackboard\" style=\"width:100%;\"><div class=\"bash codecolorer\"><span class=\"kw2\">users<\/span><\/div><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"782\" height=\"135\" class=\"wp-image-24189\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-22.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-22.png 782w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-22-300x52.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2024\/01\/word-image-24009-22-768x133.png 768w\" sizes=\"auto, (max-width: 782px) 100vw, 782px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2><a id=\"post-24009-_30svwmydxb1\"><\/a><strong>Conclusion<\/strong><\/h2>\n<p>The system administrator has to ensure the security of the system by keeping a check on all users. Using the above-mentioned two methods such as through <strong>terminal<\/strong> and <strong>GUI<\/strong>, it becomes easier to manage the system and get the user information. Through the terminal, you can use the <strong>cat<\/strong>, <strong>getnet<\/strong>, <strong>awk,<\/strong> and<strong> compgen<\/strong> commands to view the list of all users. You can also use the <strong>who <\/strong>and <strong>users <\/strong>commands to view the currently logged-in users on your system. We have discussed these commands in this post and also discussed how this command works with different arguments.<\/p>","protected":false},"excerpt":{"rendered":"<p>To list users in Debian 12, either visit the system settings or execute the getnet, awk, compgen, and cat commands with various options in the terminal.<\/p>","protected":false},"author":115,"featured_media":24195,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-24009","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-debian"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/24009","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\/115"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=24009"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/24009\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/24195"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=24009"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=24009"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=24009"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}