![Forrest logo](/images/logo.png)
last:tldr:98bd1
last: View last logins, their duration and other information as read from `/var/log/wtmp`.
$ last
try on your machine
The last
command is a Linux/Unix command that is used to display the list of last logged-in users on a system. When you execute the last
command, it retrieves the information from the /var/log/wtmp
file, which maintains a log of previous user logins and logouts.
The output of the last
command typically includes the following information for each user:
- Username: It shows the username of the last logged-in user.
- Terminal: It displays the name of the terminal or source from which the user logged in (e.g., pts/0, tty1).
- Remote Host: If the user logged in remotely, the name or IP address of the remote host is shown.
- Login Time: It shows the date and time when the user logged in to the system.
- Logout Time: If the user has already logged out, the date and time of the logout are displayed.
- Duration: It indicates the duration of the user's session, how long the user was logged in.
- Idle: If the user is currently logged in, it shows the idle time since the user's last activity.
The last
command is useful for system administrators in monitoring user activities, checking login/logout timestamps, and identifying any suspicious login attempts or unauthorized access to the system.
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.