• 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 Examples in Linux

by admin

lastlog command prints the last login times for system accounts. Login information is read from the file /var/log/lastlog.

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.

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. watch command examples to run a command repeatedly or monitor dynamically changeable files (like /proc/*)
  2. How to recover GRUB (Corrupted boot partition) in CentOS/RHEL 5,6
  3. calcurse: command not found
  4. fprintd-list Command Examples in Linux
  5. How to uninstall ssh software package from Ubuntu
  6. How to Check vendor of installed RPM packages in Linux
  7. How to Start, Stop, Restart, Check Status IIS Service by Command Line
  8. SSSD Service Failing with “SSSD is already running” in CentOS/RHEL 7
  9. How to activate a “SUSPENDED” LVM physical volume
  10. How to mount an iso file in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • protonvpn-cli Command Examples in Linux
  • protonvpn-cli connect Command Examples
  • procs Command Examples in Linux
  • prlimit: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright