4

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.

2 Answers 2

9

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.

1
  • Thanks Gilles. I tested and it works on Mac OS X and Ubuntu. Cheers Aug 17, 2010 at 16:01
1

Try with last. See man last for the options.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .