The utmp, wtmp, btmp, and lastlog files

Unlike the system log files and the authentication log files, all of these files are binary files. So, we can't use our normal text tools, such as less or grep, to read them or extract information from them. Instead, we'll use some special tools that can read these binary files.

The w and who commands pull information about who's logged in and what they're doing from the /var/run/utmp file. Both commands have their own option switches, but you likely won't ever need them. If you just want to see the list of users who are currently logged in, use who like so:

donnie@orangepione:/var/log$ whodonnie   tty7         2019-08-02 18:18 (:0)donnie   pts/1        2019-11-21 16:21 (192.168.0.251)donnie pts/2 2019-11-21 17:01 (192.168.0.251) ...

Get Mastering Linux Security and Hardening - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.