Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to determine number of time linux has rebooted? 2

Status
Not open for further replies.

jouell

MIS
Nov 19, 2002
304
US
Hi.

If I look through /var/log/messages, how do I determine how many time my linux machine has restarted?

Thanks
-jouell

 
The command "[tt]last[/tt]" will show reboots. You might have to specify an older file if your [tt]wtmp[/tt] file gets rolled.
Code:
# cd /var/log
# ls -l wtmp*
-rw-rw-r--    1 root     utmp         5760 May  7 10:58 wtmp
-rw-rw-r--    1 root     utmp       349056 Apr 27 11:26 wtmp.1
# last -f wtmp.1 | grep boot
reboot   system boot  2.4.21-20.ELsmp  Mon Apr 23 16:32         (13+18:28)  
reboot   system boot  2.4.21-20.ELsmp  Mon Apr 23 16:13          (00:08)    
reboot   system boot  2.4.21-20.ELsmp  Mon Apr 23 15:31          (00:50)    
    .
    .
    .

You can also use the "[tt]uptime[/tt]" command to just see how long since the last boot.

Hope this helps.
 
Thanks for the post!


Good to note in "man last":

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.

-jouell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top