• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

lastlog: command not found

by admin

The lastlog command is similar to the last command, but instead of listing the most recent login events, it lists all users and the last time they logged in. This command retrieves information from the /var/log/lastlog file.

lastlog Command Options

Option Description
-t n Print only logins more recent than n days ago.
-u name Print only login information for user name.

If you encounter the below error while running the lastlog command:

lastlog: command not found

you may try installing the below package as per your choice of distribution:

OS Distribution Command
Debian apt-get install login
Ubuntu apt-get install login
Alpine apk add shadow
Arch Linux pacman -S shadow
Kali Linux apt-get install login
Fedora dnf install shadow-utils
Raspbian apt-get install login

lastlog Command Examples

1. To print the last login of all the users:

# lastlog 

2. To print the records of specified days older:

# lastlog -b 10
# lastlog --before 10 

3. To print the logs more recent that specified days:

# lastlog -t 20
# lastlog --time 20 

4. To print the last login records of specified login:

# lastlog -u mike
# lastlog --user mike 

5. To display the help for lastlog:

# lastlog --help
Note: lastlog reads from /var/log/lastlog and lists the most recent login for each account.

Filed Under: Linux

Some more articles you might also be interested in …

  1. find Command Examples in Linux
  2. rfkill Command Examples in Linux
  3. findfs: command not found
  4. kool Command Examples
  5. gops Command Examples
  6. How to Determine Which Process is Writing to Disk in Linux
  7. deluge: A command-line BitTorrent client
  8. touch: command not found
  9. phar: command not found
  10. “az upgrade” Command Examples (Upgrade Azure CLI and Extensions)

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright