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:
Installation is straight forward using:
sudo apt install hardinfo
Related videos on Youtube
Author by
Selvakumar
Updated on September 18, 2022Comments
-
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 about 13 yearsgreat answer, I add | tail -10
-
Vadim Kotov over 6 yearsI have no
/etc/default/bootlogd
on my Ubuntu 16.04.2 -
mathandy about 6 yearsMore 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 over 4 yearsFor some reason it displays only the latest boot in my case
-
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 over 4 yearsNope, it displays only this:
Gtk-Message: 17:54:10.696: Failed to load module "canberra-gtk-module"