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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • 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. ssh-add: command not found
  2. systemctl: command not found
  3. “Logical volume vg/lv contains a filesystem in use” – while removing LVM filesystem
  4. pacman: command not found
  5. abduco – Terminal session manager (Command Examples)
  6. How to Disable “alt+ctrl+Del” Key Combination causing reboot in CentOS/RHEL 4,5
  7. How does “chmod -R 755” works
  8. Slow SSH login due to unreachable rsyslog server
  9. synopkg: command not found in Linux
  10. How to Change the Network Bonding Mode in CentOS/RHEL 6

You May Also Like

Primary Sidebar

Recent Posts

  • batch: Execute commands at a later time when the system load levels permit
  • bat: Print and concatenate files
  • bastet: Clone of the game Tetris in the terminal
  • bashmarks: Save and jump to commonly used directories using 1 character commands

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright