Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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

How would I be able to find logs of recent login or usage activity on my desktop? Is there a script or place in Ubuntu that holds data that tells you of recent logins from user, guest, or remote.

share|improve this question
You could combine commands w and who and unhide within a new bash-script ? Or is this too few ? – dschinn1001 Jun 4 '14 at 4:58

Actually, the best tool is the command last


You can pipe the output to less

last | less

or a file and then search the file.

share|improve this answer

You can show login history of user-accounts as following:

Go to System Settings > User Accounts and click on History button



From Command-line Open terminal and type: last

Usage: last [-num | -n num] [-f file] [-t YYYYMMDDHHMMSS] [-R] [-adioxFw] [username..] [tty..]

Ex: last pandya for activity of user=pandya

For more information see man last

last, lastb - show listing of last logged in users


Also Visit:how-can-i-track-who-sshes-into-my-linux-machine & Log SSH activity

share|improve this answer

The file /var/log/auth.log is most likely what you are looking for. The messages look like the following for local logins:

Jun  3 21:09:57 johnserver login[1810]: pam_unix(login:session): session closed for user johndoe

and like so for remote logins:

Jun  3 21:16:53 johnserver sshd[949]: Accepted password for johndoe from port 54425 ssh2

where johnserver is the hostname and johndoe is the username.

I am sorry that I do not have any knowledge on how guest logins are displayed/conveyed.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.