Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 8 down vote accepted

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.

share|improve this answer
    
Thanks Gilles. I tested and it works on Mac OS X and Ubuntu. Cheers – Brock Woolf Aug 17 '10 at 16:01

Try with last. See man last for the options.

share|improve this answer

You must log in to answer this question.

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