Forrest logo
back to the lastlog tool

lastlog:tldr:85193

lastlog: Display the most recent login of all users.
$ lastlog
try on your machine

The "lastlog" command is a Linux/Unix command used to display the most recent login activity of users on the system. It provides information about when and where each user logged in or out.

When the "lastlog" command is executed, it reads the binary file "/var/log/lastlog" and extracts information such as the user's username, their last login time, the terminal or source from which they logged in, and the time they logged out (if available).

The output of the "lastlog" command typically includes columns like Username, Port, From, Latest, and so on. The "Username" column displays the usernames of the users who have logged in, "Port" shows the terminal line number or the remote host IP address, "From" indicates the source IP or hostname, and "Latest" column reveals the last login timestamp.

Note that the "lastlog" command requires root or administrative privileges to access the "/var/log/lastlog" file and retrieve the login information accurately.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the lastlog tool