About Linux FAQ

Browse More FAQs:

Linux / UNIX: Getting information about reboots and shutdowns

Posted by Vivek Gite [Last updated: October 24, 2007]

Q. I'd like to monitor my UNIX / Linux server reboot / shutdown usage. How do I get more information about reboot and shutdown command?

A. There is a file called /var/log/wtmp. The pseudo user reboot logs in each time the system is rebooted. Thus last reboot will show a log of all reboots since the log file was created.

wtmp also contains information about reboots and shutdowns, you can list that information, by typing the following command at the shell prompt:
$ sudo last reboot
OR
# last reboot
Output:

reboot   system boot  2.6.22-14-generi Wed Oct 24 08:03 - 08:48  (00:44)
reboot   system boot  2.6.22-14-generi Tue Oct 23 21:21 - 00:40  (03:18)
reboot   system boot  2.6.22-14-generi Tue Oct 23 14:29 - 19:55  (05:26)
reboot   system boot  2.6.22-14-generi Mon Oct 22 18:36 - 19:55 (1+01:19)
reboot   system boot  2.6.22-14-generi Mon Oct 22 17:05 - 19:55 (1+02:50)
reboot   system boot  2.6.22-14-generi Mon Oct 22 14:50 - 17:03  (02:13)
reboot   system boot  2.6.22-14-generi Mon Oct 22 13:28 - 13:29  (00:01)
reboot   system boot  2.6.22-14-generi Mon Oct 22 13:07 - 13:27  (00:20)
reboot   system boot  2.6.22-14-generi Sun Oct 21 14:38 - 08:20  (17:42)
reboot   system boot  2.6.22-14-generi Sat Oct 20 10:53 - 12:54 (1+02:00)
reboot   system boot  2.6.22-14-generi Fri Oct 19 21:18 - 01:41  (04:22)
reboot   system boot  2.6.22-14-generi Fri Oct 19 16:07 - 01:41  (09:34)
reboot   system boot  2.6.22-14-generi Thu Oct 18 22:56 - 12:32  (13:35)
reboot   system boot  2.6.22-14-generi Thu Oct 18 14:30 - 12:32  (22:01)

You can also type the following command to get halt / shutdown time only:
$ last -x | grep down
Output:

vivek    tty1                          Mon Oct 22 13:25 - down   (00:01)
vivek    tty7         :0               Mon Oct 22 13:08 - down   (00:19)
vivek    tty1                          Thu Oct 18 14:25 - down   (00:04)
vivek    tty7         :0               Thu Oct 18 14:24 - down   (00:04)
vivek    tty1                          Thu Oct 18 14:16 - down   (00:00)
vivek    tty1                          Thu Oct 18 14:13 - down   (00:02)

Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.

Related Other Helpful FAQs:

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Tags: , , , , , ,

Copyright © 2006-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.