See who last logged in to a server

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the networking category.

Last Updated: 2021-05-16

When debugging a production server (e.g. to figure out what colleague's to question), you might want to see what computers logged in last (or is currently logged in). For that, use the last command:

$ last

root     pts/0        95.44.244.36     Fri Nov 15 15:16   still logged in
root     pts/0        213.61.219.34    Wed Nov 13 14:16 - 15:00  (00:44)
reboot   system boot  4.15.0-66-generi Sun Nov 10 01:24   still running
root     pts/0        87.180.201.97    Fri Nov  8 10:08 - 10:11  (00:02)
root     pts/0        78.55.6.37       Thu Nov  7 09:08 - 09:14  (00:06)
root     pts/0        87.180.201.97    Wed Nov  6 16:39 - 16:40  (00:00)