Where Do You Find the IP Address from Most Recent Login on a Linux Server?

Problem scenario
You want to know where the Linux users are logging on from (e.g., for security and configuration reasons).  You want to know the IP addresses of their desktops.  Where do you find the IP address from most recent login on a Linux server?

Solution
To see the most recent login session details (including IP address), run this command:

last

After you press enter you'll see the most recent logins.  To find the source IP address of the users that are currently logged into a Linux server, run this command:

last | grep "still logged in" | awk '{print $3}'

Leave a comment

Your email address will not be published. Required fields are marked *