Linux / Unix: Check Last Time User Logged In On The System

Linux / Unix: Check Last Time User Logged In On The System

To check the last time a user logged in on a Linux or Unix system, you can use the last command.

For example, to check the last time the user john logged in on the system, you can use the following command:

last john
Source‮tual.www:‬turi.com

This will display a list of all the times the user john has logged in on the system, along with the date and time of the login, the device they used to login (e.g., tty1, pts/0, etc.), and the duration of the login.

The last command will display the most recent logins first.

You can also use the -R option to display the logins in a more readable format.

For example:

last -R john

This will display the logins in a table format, with columns for the user name, the device they used to login, the date and time of the login, and the duration of the login.

To check the last time any user logged in on the system, you can use the last command without specifying a user name.

For example:

last

This will display a list of all the logins on the system, along with the date and time of the login, the user who logged in, the device they used to login, and the duration of the login.

Keep in mind that the last command only displays logins that have been recorded in the system's login logs. If a user has logged in remotely via SSH or through a remote desktop connection, their login may not be recorded in the login logs. In such cases, the last command may not be able to display the user's last login time.

Created Time:2017-10-29 22:08:58  Author:lautturi