Thursday, February 12, 2009


When was a system last rebooted
It is useful at times to know when a given system was last rebooted e.g. the last time a shutdown -r now command was executed. As root, execute the following commands.
# mkdir /tmp/last
# cd
# foreach f (wtmp*)
last -f $f > /tmp/last/$f
# cd /tmp/last
# grep reboot wtmp wtmp.? wtmp.??

The output from the grep command will look something like this:
wtmp:reboot system boot 2.4.21-47.0.1.EL Thu Feb 12 11:49 (01:01)
wtmp.2:reboot system boot 2.4.21-57.ELsmp Tue Dec 9 14:39 (72+03:19)
wtmp.3:reboot system boot 2.4.21-57.ELsmp Wed Nov 19 12:32 (92+05:26)
wtmp.7:reboot system boot 2.4.21-57.ELsmp Sun Jul 27 12:10 (207+06:48)

No comments: