• 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 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. ptx: command not found
  2. Linux Interview Questions – Linux Printing (CUPS)
  3. CentOS / RHEL 7 : How to install and configure telnet
  4. arduino: Arduino Studio – Integrated Development Environment for the Arduino platform
  5. assimp: Command-line client for the Open Asset Import Library
  6. rolldice Command Examples in Linux
  7. ex: Command-line text editor
  8. blight Command Examples in Linux
  9. Beginners Guide to User and Group Administration in Linux
  10. egrep Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • gml2gv Command Examples
  • glow Command Examples
  • glib-compile-resources Command Examples
  • glances Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright