Forrest logo
back to the lastb tool

lastb:tldr:e4093

lastb: Show a list of all last logged in users.
$ sudo lastb
try on your machine

The command "sudo lastb" is used to display the list of failed login attempts made on the system. Here's how it works:

  • "sudo" is a command that allows users to execute commands with administrative privileges. By using "sudo" before the command, it ensures that the command is executed with root privileges, providing access to sensitive system information.

  • "lastb" is a command that displays the recent failed login attempts on the system. It stands for "last bad" and reads the data from the file "/var/log/btmp" that records failed login attempts.

When you run "sudo lastb" command, it will output a table-like format displaying information such as the username, source IP address, the date and time of the failed login, and the authentication method used. This information is helpful for system administrators to identify and investigate any suspicious activity or unauthorized login attempts on the system.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the lastb tool