lastlog
securityLinux/Unix
The lastlog command is one of the most frequently used commands in Linux/Unix-like operating systems. lastlog Display information about the most recent login of all users
Quick Reference
Command Name:
lastlog
Category:
security
Platform:
Linux/Unix
Basic Usage:
lastlog [options] [arguments]
Common Use Cases
Syntax
lastlog [options]
Options
Option | Description |
---|---|
-b, --before DAYS |
Show users who haven't logged in for DAYS |
-C, --clear |
Clear the lastlog record of a user (requires -u) |
-h, --help |
Display help message |
-R, --root CHROOT_DIR |
Apply changes in the specified chroot directory |
-S, --set |
Set lastlog record to current time (requires -u) |
-t, --time DAYS |
Show only entries more recent than DAYS |
-u, --user LOGIN|RANGE |
Show lastlog record for specific user(s) or range of users |
--time-format FORMAT |
Display timestamps using the specified format |
-r, --reverse |
Display records in reverse order |
Examples
How to Use These Examples
The examples below show common ways to use the lastlog
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
# Basic Examples Basic
lastlog