how to use lastlog command with its examples

  • About lastlog : To print the last login of all the users
  • It comes from “shadow-utils-4.1.4.2” package.
  • Path: /usr/bin/lastlog

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

 

Leave a Reply

Your email address will not be published. Required fields are marked *