Show the places you logged in from

I only use a few locations to log into the shell accounts I have, so looking at whether an unfamiliar host has used logged in can help heighten security. Only the time of the last login can help me detect whether somebody has been using one of the machines I've been using to access my account without my knowledge, so it's a good idea to also show the last login with the date and time.

Showing which hosts you used to login to this server, is easy. Just open ~/.bashrc and add the following lines to the bottom of it:

# Show all hosts used to log into this account
last -a $USER | grep $USER | egrep -o '[^ ]+$' | sort --unique

This will look at where you ($USER) came from (last) with the full host name (-a) from that take only the lines that mention your name (|grep $USER) and from that only leave the last word on the lines, which is the host name (| egrep -o '[^ ]+$' ), finally sort this list of hostnames and remove any double occurrences (| sort --unique) and that is show on the screen.

So every time you log in, you will see a list of hosts you have used to login at earlier times.

As for the last time you logged in and where, that should have been enabled by the system administrator. If he/she hasn't, you can do it yourself by adding another line to your ~/.bashrc:

last -n 1 -a $USER | head -n 1