Linux – See the last times I logged in on Linux

command linelinuxmacosUbuntuunix

I want to see my previous logins when I login using the command line in Ubuntu 10 and I am wondering if there is a command to do it?

The command should show the last times/dates that I logged in.

Best Answer

The last command shows all previous and active logins. last $USER restricts to your user. last $USER | head -n 3 shows the latest 3.

The list of previous logins is reinitialized every month by default, and a copy of the previous month is kept (you can interrogate it with last -f /var/log/wtmp.1). This is controlled in /etc/logrotate.conf.

Related Question