Skip to content
Jassweb
  • Home
  • Company
    • About Us
    • Portfolio
    • Blog
    • Career 
  • Services
    • SEO
    • Digital Marketing
    • Web Design & Development
    • E-commerce Solutions
    • Fix Broken Website
    • Website Maintenance
    • Web Hosting & Manage Server
    • Enterprise Automation Solutions
    • Full-Stack SaaS Development
    • Coolify Automation Plugin
  • Shop
  • Tools
  • My Account
    • Cart
    • Checkout
    • My Bookings
      • Appointment canceled
      • Appointment reschedule
  • Contact Us

12 Ways to Find User Account Info and Login Details in Linux

June 28, 2023 by Jass Web

Introduction

Welcome to this guide on 12 Ways to Find User Account Info and Login Details in Linux. This guide will provide you with a comprehensive overview of the various methods you can use to find user account information and login details in Linux. We will cover topics such as using the /etc/passwd file, using the getent command, using the who command, and more. By the end of this guide, you will have a better understanding of how to find user account information and login details in Linux.

12 Ways to Find User Account Info and Login Details in Linux

1. Use the ‘who’ command: The ‘who’ command is used to display information about users currently logged into the system. It displays the user’s login name, terminal name, date and time of login, and the host from which the user logged in.

2. Use the ‘last’ command: The ‘last’ command is used to display information about the last time a user logged into the system. It displays the user’s login name, terminal name, date and time of login, and the host from which the user logged in.

3. Use the ‘finger’ command: The ‘finger’ command is used to display information about a user, including their login name, full name, home directory, shell, and other information.

4. Use the ‘id’ command: The ‘id’ command is used to display information about a user, including their user ID, group ID, and other information.

5. Use the ‘getent’ command: The ‘getent’ command is used to display information about a user, including their login name, full name, home directory, shell, and other information.

6. Use the ‘cat’ command: The ‘cat’ command is used to display the contents of a file. It can be used to view the contents of the /etc/passwd file, which contains information about all users on the system.

7. Use the ‘grep’ command: The ‘grep’ command is used to search for a pattern in a file. It can be used to search the /etc/passwd file for a particular user’s information.

8. Use the ‘pwck’ command: The ‘pwck’ command is used to check the integrity of the /etc/passwd file. It can be used to verify that a user’s information is correct.

9. Use the ‘chage’ command: The ‘chage’ command is used to change a user’s password expiry information. It can be used to view a user’s password expiry date.

10. Use the ‘usermod’ command: The ‘usermod’ command is used to modify a user’s account information. It can be used to view a user’s login name, full name, home directory, shell, and other information.

11. Use the ‘pam_listfile’ command: The ‘pam_listfile’ command is used to list the contents of a file. It can be used to view the contents of the /etc/shadow file, which contains information about user passwords.

12. Use the ‘shadow’ command: The ‘shadow’ command is used to view the contents of the /etc/shadow file. It can be used to view a user’s encrypted password.
[ad_1]

This article will show you useful ways to find information about users on a Linux system. Here we’ll describe commands to get a user’s account details, show login details as well what users are doing on the system.

If you want to add or create users in Linux, use the useradd command, and to modify or change any attributes of an already created user account, use the usermod command via the command line.

We’ll start by looking at 12 useful commands to find a user’s account information, then proceed to explain commands to view login details in the Linux system.

1. id Command – Show User and Group IDs

The id is a simple command line utility for displaying a real and effective user and group IDs identity information for the current user or specified user.

$ id tecmint
View User and Group ID's of Current User
View User and Group ID’s of Current User

2. groups Command – View User Group Memberships

The groups command is used to display the group memberships for a user. It lists all the groups that a user belongs to, including both primary and supplementary groups.

$ groups tecmint
Check User Groups in Linux
Check User Groups in Linux

3. finger Command – Show User Information

The finger command is used to search for information about a user on Linux, which includes detailed information about a specific user or a list of users, including their login name, real name, terminal, idle time, login time, and other relevant details.

The finger command doesn’t come pre-installed on many Linux distributions, you need to install it using your default package manager as shown.

$ sudo apt install finger         [On Debian, Ubuntu and Mint]
$ sudo yum install finger         [On RHEL/CentOS/Fedora and Rocky/AlmaLinux]
$ sudo emerge -a sys-apps/finger  [On Gentoo Linux]
$ sudo apk add finger             [On Alpine Linux]
$ sudo pacman -S finger           [On Arch Linux]
$ sudo zypper install finger      [On OpenSUSE]    

It shows a user’s real name; home directory; shell; login: name, time; and so much more as shown below.

$ finger tecmint
Check User Info in Linux
Check User Info in Linux

4. getent Command – Fetch User Info from System Database

The getent command is used to retrieve information from various databases, including the system user and group databases. It can be used to retrieve information about users, groups, hosts, networks, protocols, and other system entities that are stored in database files like /etc/passwd, /etc/group, /etc/hosts, etc.

To get a user’s account details, use the passwd database and the username as follows.

$ getent passwd tecmint
Fetch User Info in Linux
Fetch User Info in Linux

5. grep Command – Search for Patterns or Specific Text in Files

The grep command is a powerful command used to search for patterns or specific text in files. It allows you to filter and extract lines from text based on matching patterns. The name “grep” stands for “Global Regular Expression Print“.

You can use grep to find information about a specific user from the system accounts file: /etc/passwd as shown below.

$ grep -i tecmint /etc/passwd
Grep - Fetch User Info in Linux
Grep – Fetch User Info in Linux

6. lslogins Command – Display User Information in Linux

The lslogins command shows information about known users in the system, which typically includes details such as the username, UID (User ID), GID (Group ID), home directory, shell, last login time, and more, depending on the options used and the system configuration.

$ lslogins -u tecmint
$ lslogins -u
Display User Info in Linux
Display User Info in Linux

7. users Command – List Current Logged-In Users on Linux

The users command is used to display the list of currently logged-in users on the Linux system.

$ users
Show Current Logged in Users in Linux
Show Current Logged in Users in Linux

8. who Command – Show Information Of Currently Logged-In Users

The who command is used to display users who are logged on to the system, including the username, terminal, login time, and remote host from which the user is logged in.

$ who -u
Show Current Logged in Users
Show Current Logged-in Users

9. w Command – Show Currently Logged-In User Activity

The w command shows a summary of the currently logged-in users and their activity, which displays the login session, including the username, terminal, login time, idle time, JCPU (total CPU time used by all processes), PCPU (CPU time used by the current process), and the command or process running on the terminal.

$ w
Show Currently Logged-In User Activity
Show Currently Logged-In User Activity

10. last Command – Show Most Recent Login Session

The last command displays a list of the most recent login sessions, which includes information about the users who have logged in, their login times, and the terminals or remote hosts they used for login.

$ last
Show Most Recent Login Sessions
Show Most Recent Login Sessions

To show all the users who were present at a specified time, use the -p option as follows.

$ last -ap now
List Most Recent User Logins
List Most Recent User Logins

11. lastb Command – Show Failed Login Attempts

The lastb command is used to display a list of the last failed login attempts on the system. It reads from the system log file that records failed login attempts, typically stored in /var/log/btmp.

$ lastb
Show Failed Login Attempts in Linux
Show Failed Login Attempts in Linux

12. lastlog Command – List User Login Information

lastlog command is used to find the details of the most recent login information for all users or a specific user on the system, which provides details about the last login time and location for each user.

$ lastlog
OR
$ lastlog -u tecmint
List User Login Information
List User Login Information

That’s it! If you know any other command-line trick or command to view user account details do share with us.

In this article, we’ve explained various ways to find information about users and login details on a Linux system. You can ask any questions or share your thoughts via the feedback form below.

[ad_2]

12 Ways to Find User Account Info and Login Details in Linux

Linux is a powerful operating system that offers a variety of ways to find user account information and login details. Here are 12 ways to find user account info and login details in Linux.

1. Using the ‘who’ Command

The ‘who’ command is a simple command that can be used to find out who is currently logged in to the system. It will display the user name, terminal name, and the time of login. To use the ‘who’ command, simply type ‘who’ in the terminal and press enter.

2. Using the ‘finger’ Command

The ‘finger’ command is a more detailed version of the ‘who’ command. It will display the user name, terminal name, time of login, and other information such as the user’s full name, home directory, and shell. To use the ‘finger’ command, simply type ‘finger’ in the terminal and press enter.

3. Using the ‘last’ Command

The ‘last’ command is used to display a list of the last users who have logged in to the system. It will display the user name, terminal name, time of login, and other information such as the user’s full name, home directory, and shell. To use the ‘last’ command, simply type ‘last’ in the terminal and press enter.

4. Using the ‘id’ Command

The ‘id’ command is used to display the user ID and group ID of the current user. It will also display the user name, terminal name, and time of login. To use the ‘id’ command, simply type ‘id’ in the terminal and press enter.

5. Using the ‘groups’ Command

The ‘groups’ command is used to display the groups that the current user belongs to. It will display the user name, terminal name, and time of login. To use the ‘groups’ command, simply type ‘groups’ in the terminal and press enter.

6. Using the ‘passwd’ Command

The ‘passwd’ command is used to display the password of the current user. It will display the user name, terminal name, and time of login. To use the ‘passwd’ command, simply type ‘passwd’ in the terminal and press enter.

7. Using the ‘chage’ Command

The ‘chage’ command is used to display the password expiration date of the current user. It will display the user name, terminal name, and time of login. To use the ‘chage’ command, simply type ‘chage’ in the terminal and press enter.

8. Using the ‘pwck’ Command

The ‘pwck’ command is used to check the integrity of the user accounts in the system. It will display the user name, terminal name, and time of login. To use the ‘pwck’ command, simply type ‘pwck’ in the terminal and press enter.

9. Using the ‘usermod’ Command

The ‘usermod’ command is used to modify the user account information. It will display the user name, terminal name, and time of login. To use the ‘usermod’ command, simply type ‘usermod’ in the terminal and press enter.

10. Using the ‘userdel’ Command

The ‘userdel’ command is used to delete a user account. It will display the user name, terminal name, and time of login. To use the ‘userdel’ command, simply type ‘userdel’ in the terminal and press enter.

11. Using the ‘getent’ Command

The ‘getent’ command is used to display the user account information from the system database. It will display the user name, terminal name, and time of login. To use the ‘getent’ command, simply type ‘getent’ in the terminal and press enter.

12. Using the ‘grep’ Command

The ‘grep’ command is used to search for a specific user account in the system. It will display the user name, terminal name, and time of login. To use the ‘grep’ command, simply type ‘grep’ in the terminal and press enter.

Categories Linux, Linux Commands Tags check users in linux, find linux user login details, get linux user info, linux find user details, linux tricks
PHP artisan migrate specific migration
Getting Started With Volumio On Raspberry Pi (Media Player)
© 2026 Jassweb • Built with GeneratePress