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?
2 Answers
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).
-
-
1
-
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).– mathandyFeb 17, 2018 at 0:24
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
-
-
@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 Feb 3, 2020 at 11:40 -
Nope, it displays only this:
Gtk-Message: 17:54:10.696: Failed to load module "canberra-gtk-module"
Feb 3, 2020 at 14:55