The last command is used to display information about the users who have recently logged in or out of a Linux or Unix system. It reads the wtmp file, which is a record of all logins and logouts on the system.
Here are some examples of how you can use the last command:
last command with no options:lastSowww:ecru.lautturi.com
This will display a list of the logins and logouts, along with the date and time of the login or logout, the user's name, and the terminal or hostname from which the user logged in.
-u option followed by the user's name:last -u username
This will display a list of logins and logouts for the specified user.
-t option followed by the terminal or hostname:last -t terminal_name
This will display a list of logins and logouts from the specified terminal or hostname.
-s and -e options, followed by the start and end dates:last -s start_date -e end_date
This will display a list of logins and logouts that occurred within the specified time range. The start and end dates should be in the format YYYY-MM-DD.
For more information about the last command and its available options, you can consult the last man page or use the last --help command.