How do I find the last logged system boot and shutdown times?

33,803

Solution 1

Use the last command.

last -x | grep shutdown
last -x | grep reboot

You can pipe this to the head to read the last n instances. For example, in your case:

last -x | grep shutdown | head -n 10

You also should set

BOOTLOGD_ENABLE=Yes

in the /etc/default/bootlogd file (it could be No by default).

Solution 2

For a GUI method you can use hardinfo as described here: Does Ubuntu have a "device manager" equivalent? And what is an easy way to access USB drives?.

Under the section Boots you will see this:

Hardinfo boot log.png

Installation is straight forward using:

sudo apt install hardinfo
Share:
33,803

Related videos on Youtube

Selvakumar
Author by

Selvakumar

Updated on September 18, 2022

Comments

  • Selvakumar
    Selvakumar over 1 year

    I'm a Rails developer working on a web application on Ubuntu Server 10.04. Due to internal requirements, I was asked to find the last 10 system boot and shutdown times... I have no clue where to find these details. Could someone help me out?

  • enzotib
    enzotib about 13 years
    great answer, I add | tail -10
  • Vadim Kotov
    Vadim Kotov over 6 years
    I have no /etc/default/bootlogd on my Ubuntu 16.04.2
  • mathandy
    mathandy about 6 years
    More on how to enable bootlogd, which is not necessary as of Debian Wheezy (i.e. as of Ubuntu 11.10 -- or so seems likely).
  • Vadim Kotov
    Vadim Kotov over 4 years
    For some reason it displays only the latest boot in my case
  • WinEunuuchs2Unix
    WinEunuuchs2Unix over 4 years
    @VadimKotov When you type hardinfo from the command line do you see errors as in this bug report? bugs.launchpad.net/ubuntu/+source/hardinfo/+bug/1473142
  • Vadim Kotov
    Vadim Kotov over 4 years
    Nope, it displays only this: Gtk-Message: 17:54:10.696: Failed to load module "canberra-gtk-module"