Shell script to check login history in Linux

Written By - admin

5 thoughts on “Shell script to check login history in Linux”

    • This is to perform a IP to hostname lookup. We are using Google’s DNS to perform the lookup. Since my lab is in private network, I am getting NXDOMAIN, but if you do a lookup of a public IP then you should get proper hostname value. Or you can also use your own DNS (if any) to perform hostname lookup

  1. The script works well but a lot of lines with “grep: Invalid back reference” may be some problem with the version of egrep ? I’m on a Centos 7 machine

    • Store printf content to a log file and run this script using cron. You can adjust the cron value based on your requirement. For example to run everyday at 8 AM use 0 8 * * *


Leave a Comment