Collecting information about logged in users, boot logs, and boot failures

Collecting information about the operating environment, logged in users, the time for which the computer has been powered on, and boot failures are very helpful. This recipe will go through a few commands used to gather information about a live machine.

Getting ready

This recipe will introduce commands who, w, users, uptime, last, and lastb.

How to do it...

  1. To obtain information about users currently logged into the machine use:
    $ who
    slynux   pts/0   2010-09-29 05:24 (slynuxs-macbook-pro.local)
    slynux   tty7    2010-09-29 07:08 (:0) 
    

    This output lists the login name, the TTY used by the users, login time, and remote hostname (or X display information) about logged in users.

    Note

    TTY ...

Get Linux Shell Scripting Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.