commands.sh

last

linux

View the last logged in users.

More info →

Options (6)

-n, --limitboolean

Specify how many of the last logins to show

Example: last {{[-n|--limit]}} {{login_count}}
-F, --fulltimesboolean

Print the full date and time for entries and then display the hostname column last to prevent truncation

Example: last {{[-F|--fulltimes]}} {{[-a|--hostlast]}}
-a, --hostlastboolean

Print the full date and time for entries and then display the hostname column last to prevent truncation

Example: last {{[-F|--fulltimes]}} {{[-a|--hostlast]}}
-i, --ipboolean

View all logins by a specific user and show the IP address instead of the hostname

Example: last {{username}} {{[-i|--ip]}}
-s, --sinceboolean

List information since a specific time and date

Example: last {{[-s|--since]}} {{-7days}}
-h, --helpboolean

Display help

Example: last {{[-h|--help]}}

Examples (8)

View last login information (e.g., username, terminal, boot time, kernel) of all users as read from `/var/log/wtmp`

List login information of a specific user

last username

Specify how many of the last logins to show

last [-n|--limit] login_count

Print the full date and time for entries and then display the hostname column last to prevent truncation

last [-F|--fulltimes] [-a|--hostlast]

View all logins by a specific user and show the IP address instead of the hostname

last username [-i|--ip]

List information since a specific time and date

last [-s|--since] -7days

View all recorded reboots (i.e., the last logins of the pseudo user "reboot")

Display help

last [-h|--help]
made by @shridhargupta | data from tldr-pages