

{"id":111570,"date":"2023-01-24T09:00:42","date_gmt":"2023-01-24T03:30:42","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=111570"},"modified":"2023-01-24T10:22:09","modified_gmt":"2023-01-24T04:52:09","slug":"user-account-information-in-linux","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/user-account-information-in-linux\/","title":{"rendered":"How to find User Account Information in Linux?"},"content":{"rendered":"<p><span style=\"font-weight: 400\">In this article, we will be looking at the various commands that give us valuable information on the users&#8217; accounts In Linux-based operating systems. We will go through various commands like id, group, whoami, finger, getent, grep, lslogins, users, who, and so on. So pay attention, take notes, and read right till the end.<\/span><\/p>\n<h3><span style=\"font-weight: 400\">Why do we need user account information?<\/span><\/h3>\n<p><span style=\"font-weight: 400\">Before addressing the question of what, let us discuss why we need user account information. Well, we all know that Linux is a multiuser platform. Therefore, we must manage these users properly to keep the system productive, organized, and functional.\u00a0<\/span><\/p>\n<p>The system administrator must know all the users using the system to manage them and their permissions<span style=\"font-weight: 400\">. Therefore, tracking all the users is a significant job. We can use multiple tools, <\/span>which we will look at in depth in this article. We also know that everything in Linux is a file, and all of the information about users is contained in the &#8220;\/etc\/passwd&#8221; file. The respective hash passwords are present in<span style=\"font-weight: 400\"> the &#8220;\/etc\/shadow&#8221; file.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400\">In a nutshell, it is an essential job of system administrators to monitor the users in the system. To do this task, we have many monitoring commands like d, group, whoami, finger, getent, grep, lslogins, users, who, lastb, lastlog, w, and more.\u00a0<\/span><\/p>\n<h3><span style=\"font-weight: 400\">What is the user account information?<\/span><\/h3>\n<p><span style=\"font-weight: 400\">The user account information contains various information like the user name, the time of login, last time of login, account expiry date, password expiry date, idle time, login time, email address, plan, project, pgpkey, and countless more information! It only depends on what you are capable of asking Linux.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Let us look at some user information look-up commands :<\/span><\/p>\n<h4><span style=\"font-weight: 400\">1. Linux Id command<\/span><\/h4>\n<p><span style=\"font-weight: 400\">The id command is a command-line-based user information look-up command that prints out the user and group names and numeric ids of the current user or any other user on the server. We can combine the id command with various options to get specific information. The id command shows the following information:<\/span><\/p>\n<ul>\n<li>User name and real user id.<\/li>\n<li>User UID.<\/li>\n<li>Groups associated with a user.<\/li>\n<li>Groups a user belongs to.<\/li>\n<li>Security context of the current user.<\/li>\n<\/ul>\n<p><b>Syntax of the id command in Linux<\/b><\/p>\n<p><span style=\"font-weight: 400\">The syntax of the id command is<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">id &lt;options&gt; &lt;user&gt;.\r\n<\/pre>\n<p><b>Options used with the id command<\/b><\/p>\n<p><span style=\"font-weight: 400\">The options that are used with the id command are:<\/span><\/p>\n<p><span style=\"font-weight: 400\"><strong>1. -g &#8211;<\/strong> Print only the effective group id.<\/span><\/p>\n<p><span style=\"font-weight: 400\"><strong>2. -G<\/strong> &#8211; Print all Group ids.<\/span><\/p>\n<p><span style=\"font-weight: 400\"><strong>3. -n &#8211;<\/strong> Prints name instead of the number.<\/span><\/p>\n<p><span style=\"font-weight: 400\"><strong>4. -r &#8211;<\/strong> Prints real ID instead of numbers.<\/span><\/p>\n<p><span style=\"font-weight: 400\"><strong>5. -u &#8211;<\/strong> Prints only the effective user ID.<\/span><\/p>\n<p><span style=\"font-weight: 400\"><strong>6. &#8211;help &#8211;<\/strong> Prints the help menu of the id command.<\/span><\/p>\n<p><span style=\"font-weight: 400\"><strong>7. &#8211;version &#8211;<\/strong> Prints the information about the version of the id command.<\/span><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/01\/version-3.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111637\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/01\/version-3.webp\" alt=\"version\" width=\"1748\" height=\"812\" \/><\/a><\/p>\n<h3><span style=\"font-weight: 400\">2. Linux Groups command<\/span><\/h3>\n<p><span style=\"font-weight: 400\">The &#8216;groups command&#8217; is a command-line-based user information look-up command that <\/span>prints the names of the primary groups and any supplementary groups for each of the given username. If no username is given, it considers the current process<span style=\"font-weight: 400\">. If you give more than one name, the groups command prints each user&#8217;s name in the list of that user&#8217;s groups.\u00a0<\/span><\/p>\n<p><b>Syntax of the groups command in Linux<\/b><\/p>\n<p><span style=\"font-weight: 400\">The syntax of the groups command is<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">groups &lt;user&gt;.\r\n<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/01\/groups.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111638\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/01\/groups.webp\" alt=\"groups\" width=\"1748\" height=\"212\" \/><\/a><\/p>\n<h4><span style=\"font-weight: 400\">3. Linux Finger command<\/span><\/h4>\n<p><span style=\"font-weight: 400\">The finger command is a command-line-based utility in Linux-based operating systems that <\/span>gives the details of all the users that are currently logged in<span style=\"font-weight: 400\">. There are various user information look-up commands like &#8220;whoami&#8221;, &#8220;who&#8221;, &#8220;lastlog&#8221;, &#8220;users&#8221;, and more. The finger command is one such user information look-up command.<\/span><\/p>\n<h5>Installing the finger command in Linux<\/h5>\n<p><span style=\"font-weight: 400\">The finger command does not come preinstalled in most Linux distributions. Don&#8217;t panic. You can always download it with the commands below regarding your Linux distro.<\/span><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/01\/finger.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111639\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/01\/finger.webp\" alt=\"finger\" width=\"1748\" height=\"588\" \/><\/a><\/p>\n<ul>\n<li><span style=\"font-weight: 400\"> Debian-based distros &#8211; sudo apt install finger<\/span><\/li>\n<li><span style=\"font-weight: 400\"> RHEL-based distros &#8211; sudo yum install finger<\/span><\/li>\n<li><span style=\"font-weight: 400\"> Fedora-based distros &#8211; sudo dnf install finger <\/span><\/li>\n<\/ul>\n<p><b>Syntax of the finger command<\/b><\/p>\n<p><span style=\"font-weight: 400\">The syntax of the finger command is:<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">finger &lt;options&gt; &lt;user&gt;\r\n<\/pre>\n<p><b>Options used with the finger command\u00a0<\/b><\/p>\n<p><span style=\"font-weight: 400\">Unlike most of the commands in Linux, the finger command has only a few options associated with it. Let us take a brief look at each one of them:<\/span><\/p>\n<p><strong>a. -s<\/strong><\/p>\n<p><span style=\"font-weight: 400\">This option displays various information like the user&#8217;s login name, real name, and terminal name and writes <\/span>status,, office location, idle time, login time, and office phone number.<\/p>\n<p><strong>b. -l<\/strong><\/p>\n<p><span style=\"font-weight: 400\">This option prints various additional information to the one printed by the option &#8220;-s&#8221;. This additional information consists of the user&#8217;s home directory, home phone number, login shell, mail status, and also the contents of the files from the user&#8217;s home directory like &#8220;.plan&#8221;, &#8220;.project&#8221;, &#8220;.pgpkey&#8221; and &#8220;.forward&#8221;.<\/span><\/p>\n<p><strong>c. -p<\/strong><\/p>\n<p><span style=\"font-weight: 400\">This option prevents the option &#8220;-l&#8221; of the finger command <\/span>from displaying the contents of the\u00a0 &#8220;.pgpkey&#8221;, &#8220;.project&#8221;, and &#8220;.plan&#8221; files<span style=\"font-weight: 400\"> from the user&#8217;s home directory.<\/span><\/p>\n<p><strong>d. -m<\/strong><\/p>\n<p><span style=\"font-weight: 400\">This option prevents the matching of usernames.\u00a0<\/span><\/p>\n<p><b>Output of the finger command<\/b><\/p>\n<p><span style=\"font-weight: 400\">To display the information of a specific user, run the finger command followed by the name of the user you are searching for as shown:<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">finger &lt;user&gt;\r\n<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/01\/finger-file.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111640\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/01\/finger-file.webp\" alt=\"finger file\" width=\"1748\" height=\"248\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400\">Let us understand the information displayed by the finger command:<\/span><\/p>\n<ul>\n<li><span style=\"font-weight: 400\"><strong> Login<\/strong> &#8211; Shows the login name of a user<\/span><\/li>\n<li><span style=\"font-weight: 400\"><strong> Name<\/strong> &#8211; Shows the full name of a user<\/span><\/li>\n<li><span style=\"font-weight: 400\"><strong> Directory<\/strong> &#8211; Shows the home directory of a user<\/span><\/li>\n<li><span style=\"font-weight: 400\"><strong> Shell<\/strong> &#8211; Shows the shell used by a user<\/span><\/li>\n<li><span style=\"font-weight: 400\"><strong> On since<\/strong> &#8211; Shows the user&#8217;s logged-in time and date<\/span><\/li>\n<li><span style=\"font-weight: 400\"><strong> Mail<\/strong> &#8211; Shows the mails of a user if there are any to be shown<\/span><\/li>\n<li><span style=\"font-weight: 400\"><strong> Plan<\/strong> &#8211; Shows the plans of a user<\/span><\/li>\n<\/ul>\n<h4><span style=\"font-weight: 400\">4. Linux Getent command<\/span><\/h4>\n<p><span style=\"font-weight: 400\">The getent command is a command-line-based user information look-up command that helps the user get the entries in several important text files called databases. These databases include &#8220;passwd&#8221; and the &#8220;group&#8221;, which store the user information.\u00a0<\/span><\/p>\n<p><b>Syntax of the getent command<\/b><\/p>\n<p><span style=\"font-weight: 400\">The syntax of the getent command is: <\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">getent &lt;database&gt; &lt;key&gt;\r\n<\/pre>\n<p><b>Options used with the getent command\u00a0<\/b><\/p>\n<p><span style=\"font-weight: 400\">The options used with the getent command are:<\/span><\/p>\n<ul>\n<li><span style=\"font-weight: 400\"> -s &#8211; Overrides all the databases with the specified service.<\/span><\/li>\n<li><span style=\"font-weight: 400\"> -S &#8211; Override <\/span>only the specified databases with the specified service. The option may be used multiple times, but only the last service for each of the databases will be<span style=\"font-weight: 400\"> used.<\/span><\/li>\n<li><span style=\"font-weight: 400\"> -i &#8211; disables IDN encoding in the look-ups for hosts\/getaddrinfo.<\/span><\/li>\n<li><span style=\"font-weight: 400\"> &#8211;help &#8211; Prints the help menu of the getent command.<\/span><\/li>\n<li><span style=\"font-weight: 400\"> &#8211;usage &#8211; Prints a short usage summary and exit.<\/span><\/li>\n<li><span style=\"font-weight: 400\"> -V &#8211; prints the information regarding the getent command.<\/span><\/li>\n<\/ul>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/01\/getent.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111641\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/01\/getent.webp\" alt=\"getent\" width=\"1812\" height=\"920\" \/><\/a><\/p>\n<h4><span style=\"font-weight: 400\">5. Linux Grep command<\/span><\/h4>\n<p><span style=\"font-weight: 400\">Grep command is a LINUX command which stands for Global regular expression print. The grep command searches a file(s) for a word(s), sentence(s), or any pattern of words or characters and displays all the lines that contain the same. You can use this command to search for various user-related information too. For example, I can search for a specific user name in the passwd database as shown below:<\/span><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/01\/grep.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111642\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/01\/grep.webp\" alt=\"grep\" width=\"1748\" height=\"188\" \/><\/a><\/p>\n<p><b>Syntax of the grep command<\/b><\/p>\n<p><span style=\"font-weight: 400\">The syntax of grep is:<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">grep &lt;options&gt; \"word\/sentence\" &lt;file(s)&gt;.\r\n<\/pre>\n<h4><span style=\"font-weight: 400\">6. Linux Lslogins command\u00a0<\/span><\/h4>\n<p><span style=\"font-weight: 400\">The lslogins command is a command-line-based user information look-up command that lists all users&#8217; logins. For example, pair the lslogins command with the option &#8220;-u&#8221; to print only the logins of the system users (which start from UID 1000), as shown below:<\/span><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/01\/lslogins.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111643\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/01\/lslogins.webp\" alt=\"lslogins\" width=\"1748\" height=\"588\" \/><\/a><\/p>\n<h4><span style=\"font-weight: 400\">7. Linux Users Command<\/span><\/h4>\n<p><span style=\"font-weight: 400\">The &#8216;users command&#8217; is a command-line-based user information look-up command that shows <\/span>the usernames of users that are currently logged in to the current host.<\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/01\/users.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111644\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/01\/users.webp\" alt=\"users\" width=\"1748\" height=\"588\" \/><\/a><\/p>\n<h4><span style=\"font-weight: 400\">8. Linux Who command<\/span><\/h4>\n<p><span style=\"font-weight: 400\">The &#8216;who command&#8217; is a command-line-based user information look-up command that shows the following information:<\/span><\/p>\n<ul>\n<li><span style=\"font-weight: 400\"> Time of last system boot.<\/span><\/li>\n<li><span style=\"font-weight: 400\"> Current run level of the system.<\/span><\/li>\n<li><span style=\"font-weight: 400\"> List of logged-in users and more.<\/span><\/li>\n<\/ul>\n<p><b>Syntax of the who command<\/b><\/p>\n<p><span style=\"font-weight: 400\">The syntax of the who command is<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">who &lt;options&gt; &lt;filename&gt;.\r\n<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/01\/who-1.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111645\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/01\/who-1.webp\" alt=\"who\" width=\"1748\" height=\"408\" \/><\/a><\/p>\n<h4><span style=\"font-weight: 400\">9. Linux W command<\/span><\/h4>\n<p><span style=\"font-weight: 400\">The w command is a command-line-based user information look-up command that shows the users logged on and what they are doing. In addition, it shows other information like <\/span>how many users are currently logged on, how long the system has been running, and<span style=\"font-weight: 400\"> more.\u00a0<\/span><\/p>\n<p><b>Syntax of the w command<\/b><\/p>\n<p><span style=\"font-weight: 400\">The syntax of the w command is<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">w &lt;options&gt; &lt;user&gt;.\r\n<\/pre>\n<p><b>Options used with the w command\u00a0<\/b><\/p>\n<p><span style=\"font-weight: 400\">The options used with the w command are:<\/span><\/p>\n<ul>\n<li><span style=\"font-weight: 400\"><strong> -h &#8211;<\/strong> Does not print headers.<\/span><\/li>\n<li><span style=\"font-weight: 400\"><strong> -u &#8211;<\/strong> Ignores current process username.<\/span><\/li>\n<li><span style=\"font-weight: 400\"> &#8211;<strong>s &#8211;<\/strong> Print in short format.<\/span><\/li>\n<li><span style=\"font-weight: 400\"><strong> -f &#8211;<\/strong> show remote hostname field.<\/span><\/li>\n<li><span style=\"font-weight: 400\"><strong> -o &#8211;<\/strong> Display in the old format.<\/span><\/li>\n<li><span style=\"font-weight: 400\"><strong> -i &#8211;<\/strong> Display the IP address instead of the hostname.<\/span><\/li>\n<li><span style=\"font-weight: 400\"><strong> -V &#8211;<\/strong> Prints information about the version of the w command.<\/span><\/li>\n<\/ul>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/01\/w.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111646\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/01\/w.webp\" alt=\"w\" width=\"1748\" height=\"592\" \/><\/a><\/p>\n<h4><span style=\"font-weight: 400\">10. Linux Whoami command<\/span><\/h4>\n<p><span style=\"font-weight: 400\">The w command is a command-line-based user information look-up command that displays the current user&#8217;s username.\u00a0<\/span><\/p>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/01\/whoami.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111647\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/01\/whoami.webp\" alt=\"whoami\" width=\"1748\" height=\"500\" \/><\/a><\/p>\n<h4><span style=\"font-weight: 400\">11. Linux Lastlog command<\/span><\/h4>\n<p><span style=\"font-weight: 400\">The lastlog command is a command-line-based user information look-up command that prints the last login times for system accounts. This login information is read from the file \/var\/log\/lastlog.<\/span><\/p>\n<p><b>Syntax of the lastlog command<\/b><\/p>\n<p><span style=\"font-weight: 400\">The syntax of the lastlog command is <\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">lastlog &lt;options&gt; &lt;argument&gt;.\r\n<\/pre>\n<p><b>Options used with the lastlog command\u00a0<\/b><\/p>\n<p><span style=\"font-weight: 400\">The options used with the lastlog command are:<\/span><\/p>\n<ul>\n<li><span style=\"font-weight: 400\"><strong> -b &#8211;<\/strong> print only lastlog records older than the specified days.<\/span><\/li>\n<li><span style=\"font-weight: 400\"><strong> -C &#8211;<\/strong> clear lastlog record of a user.<\/span><\/li>\n<li><span style=\"font-weight: 400\"><strong> -h &#8211;<\/strong> print the help menu of the lastlog command.<\/span><\/li>\n<li><span style=\"font-weight: 400\"><strong> -S &#8211;<\/strong> sets the lastlog record to the current time.<\/span><\/li>\n<li><span style=\"font-weight: 400\"><strong> -t &#8211;<\/strong> print only lastlog record more recent than the specified days.<\/span><\/li>\n<li><span style=\"font-weight: 400\"><strong> -u &#8211;<\/strong> print lastlog record of the specified username.<\/span><\/li>\n<li><span style=\"font-weight: 400\"><strong> -R &#8211;<\/strong> directory to chroot\u00a0<\/span><\/li>\n<\/ul>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/01\/lastlog.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111648\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/01\/lastlog.webp\" alt=\"lastlog\" width=\"1748\" height=\"448\" \/><\/a><\/p>\n<h3><span style=\"font-weight: 400\">12. Linux Last Command<\/span><\/h3>\n<p><span style=\"font-weight: 400\">The last command is the last user monitoring command we will discuss in this article (no pun intended). This command displays the list of all u<\/span>sers logged in and out since the creation of the file \/var\/log\/wtmp<span style=\"font-weight: 400\">. You can also pass more than one username <\/span>as an argument to display their hostname, login in and log out time<span style=\"font-weight: 400\">.<\/span><\/p>\n<p><b>Syntax of the last command<\/b><\/p>\n<p><span style=\"font-weight: 400\">The syntax of the last command is<\/span><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">lastlog &lt;options&gt; &lt;user&gt; &lt;tty&gt;.\r\n<\/pre>\n<p><b>Options used with the last command in Linux<\/b><\/p>\n<p><span style=\"font-weight: 400\">The options used with the last command are:<\/span><\/p>\n<ul>\n<li><span style=\"font-weight: 400\"> -a &#8211; display hostnames in the last column.<\/span><\/li>\n<li><span style=\"font-weight: 400\"> -d &#8211; translate the IP number back into a hostname.<\/span><\/li>\n<li><span style=\"font-weight: 400\"> -f &#8211; <\/span><b>use a specific file instead of \/var\/log\/wtmp<\/b><span style=\"font-weight: 400\">.<\/span><\/li>\n<li><span style=\"font-weight: 400\"> -F &#8211; print full login and logout time and dates.<\/span><\/li>\n<li><span style=\"font-weight: 400\"> -i &#8211; display IP numbers in numbers-and-dots notation.<\/span><\/li>\n<li><span style=\"font-weight: 400\"> -n &#8211; specify the number of lines to show.<\/span><\/li>\n<li><span style=\"font-weight: 400\"> -R &#8211; don&#8217;t display the field containing the hostname.<\/span><\/li>\n<li><span style=\"font-weight: 400\"> -s &#8211; display the lines since the specified time.<\/span><\/li>\n<li><span style=\"font-weight: 400\"> -t &#8211; display the line until the specified time.<\/span><\/li>\n<li><span style=\"font-weight: 400\"> -p &#8211; display who was present at the specified time.<\/span><\/li>\n<li><span style=\"font-weight: 400\"> -w &#8211; display full user and domain names.<\/span><\/li>\n<li><span style=\"font-weight: 400\"> -x &#8211; display system shutdown entries and run level changes.<\/span><\/li>\n<li><span style=\"font-weight: 400\"> &#8211;help &#8211; print the help menu of the last command.<\/span><\/li>\n<li><span style=\"font-weight: 400\"> &#8211;version &#8211; print the information regarding the version of the last command you are using in your system.\u00a0<\/span><\/li>\n<\/ul>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/01\/last-5.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-111649\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/01\/last-5.webp\" alt=\"last 5\" width=\"1748\" height=\"744\" \/><\/a><\/p>\n<h3><span style=\"font-weight: 400\">Summary<\/span><\/h3>\n<p><span style=\"font-weight: 400\">You have now learned why monitoring users is essential, what is user account information, and 12 beautiful user information look-up commands, namely: id, groups, finger, getent, grep, lslogins, users, who, w, whoami, lastlog, and last.\u00a0<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we will be looking at the various commands that give us valuable information on the users&#8217; accounts In Linux-based operating systems. We will go through various commands like id, group, whoami,&#46;&#46;&#46;<\/p>\n","protected":false},"author":5,"featured_media":111578,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35],"tags":[27205],"class_list":["post-111570","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","tag-user-account-information-in-linux"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to find User Account Information in Linux? - DataFlair<\/title>\n<meta name=\"description\" content=\"Learn why monitoring users is essential in linux, what is user account information &amp; its look-up commands like id, groups, finger, getent etc\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/user-account-information-in-linux\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to find User Account Information in Linux? - DataFlair\" \/>\n<meta property=\"og:description\" content=\"Learn why monitoring users is essential in linux, what is user account information &amp; its look-up commands like id, groups, finger, getent etc\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/user-account-information-in-linux\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-01-24T03:30:42+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-01-24T04:52:09+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/01\/checking-user-information.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"11 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to find User Account Information in Linux? - DataFlair","description":"Learn why monitoring users is essential in linux, what is user account information & its look-up commands like id, groups, finger, getent etc","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/user-account-information-in-linux\/","og_locale":"en_US","og_type":"article","og_title":"How to find User Account Information in Linux? - DataFlair","og_description":"Learn why monitoring users is essential in linux, what is user account information & its look-up commands like id, groups, finger, getent etc","og_url":"https:\/\/data-flair.training\/blogs\/user-account-information-in-linux\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2023-01-24T03:30:42+00:00","article_modified_time":"2023-01-24T04:52:09+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/01\/checking-user-information.webp","type":"image\/webp"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"11 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/user-account-information-in-linux\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/user-account-information-in-linux\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823"},"headline":"How to find User Account Information in Linux?","datePublished":"2023-01-24T03:30:42+00:00","dateModified":"2023-01-24T04:52:09+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/user-account-information-in-linux\/"},"wordCount":1804,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/user-account-information-in-linux\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/01\/checking-user-information.webp","keywords":["User Account Information in Linux"],"articleSection":["Linux Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/user-account-information-in-linux\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/user-account-information-in-linux\/","url":"https:\/\/data-flair.training\/blogs\/user-account-information-in-linux\/","name":"How to find User Account Information in Linux? - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/user-account-information-in-linux\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/user-account-information-in-linux\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/01\/checking-user-information.webp","datePublished":"2023-01-24T03:30:42+00:00","dateModified":"2023-01-24T04:52:09+00:00","description":"Learn why monitoring users is essential in linux, what is user account information & its look-up commands like id, groups, finger, getent etc","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/user-account-information-in-linux\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/user-account-information-in-linux\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/user-account-information-in-linux\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/01\/checking-user-information.webp","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/01\/checking-user-information.webp","width":1200,"height":628,"caption":"checking user information"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/user-account-information-in-linux\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"Linux Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/linux\/"},{"@type":"ListItem","position":3,"name":"How to find User Account Information in Linux?"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/7f83c342f5d1632d6f7b4b0b0f447823","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4cf3a74600d131330b8c481d519afd1574093ed89f6d3396a95393ad223eb7cd?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team creates expert-level guides on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. Our goal is to empower learners with easy-to-understand content. Explore our resources for career growth and practical learning.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam1\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/111570","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=111570"}],"version-history":[{"count":3,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/111570\/revisions"}],"predecessor-version":[{"id":111650,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/111570\/revisions\/111650"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/111578"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=111570"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=111570"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=111570"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}