List all recent logins to Linux server

last command list all recent logins to your linux server.

Linux Last Command

To list only last 5 logins, run

As you can see, last shows IP of the user, by default it show hostname of the remote server. In above example, it show “admin.serverok.i”, this is turncated. To see full hostname, run

if you don’t want IP converted to hostname, run

Last stores login data in file /var/log/wtmp. Old files will be rotated, so to see old logins you need to specify the location of the file using -f argument.

Example

File name may be differnt in your server, check /var/log folder for actual file names.