O'Reilly logo

Mastering Linux Shell Scripting by Andrew Mallett

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 12. A Better lastlog with Awk

We have already seen in Chapter 11, Summarizing Logs with Awk, how we can create complex reports from large amounts of data mined from purely text files. Similarly, we can create extensive reports using the output from standard command-line tools, such as the lastlog tool. In itself lastlog can report the last login time for all users. Often though, we may wish to filter the output from lastlog. Perhaps you need to exclude the user accounts that have never been used to login to the system. It may also be irrelevant to report on root, as the account may be predominately used for sudo only and not used to record regularly for standard logins.

In working through this chapter, we will work both with lastlog and ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required