last
systemLinux/Unix
The last command is one of the most frequently used commands in Linux/Unix-like operating systems. last Show listing of last logged in users
Quick Reference
Command Name:
last
Category:
system
Platform:
Linux/Unix
Basic Usage:
last [options] [arguments]
Common Use Cases
Syntax
last [options] [username...] [tty...]
Options
Option | Description |
---|---|
-a, --hostlast |
Display hostname in the last column |
-d, --dns |
Translate IP addresses to hostnames |
-f, --file file |
Use specified file instead of /var/log/wtmp |
-F, --fulltimes |
Print full login and logout times and dates |
-i, --ip |
Display IP addresses instead of hostnames |
-n, --limit N |
Show only the last N entries |
-R, --nohostname |
Don't display the hostname field |
-s, --since time |
Display entries since the specified time |
-t, --until time |
Display entries until the specified time |
-p, --present time |
Display users who were present at the specified time |
-w, --fullnames |
Display full user and domain names |
-x, --system |
Display system shutdown entries and run level changes |
--time-format format |
Show timestamps in the specified format |
-h, --help |
Display help message |
-V, --version |
Display version information |
Examples
How to Use These Examples
The examples below show common ways to use the last
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
# Basic Examples Basic
last