Linux Find Out Last System Reboot Time and Date Command

Use the last command to display listing of last logged in users and system last reboot time and date, enter:
$ last reboot | less
Or, better try:
$ last reboot | head -1
Sample outputs:session

reboot   system boot  2.6.15.4         Sun Apr 30 15:08 - 16:22  (01:13)

The last command searches back through the file /var/log/wtmp and displays a list of all users logged in (and out) since that file was created. The pseudo user reboot logs in each time the system is rebooted. Thus last reboot command will show a log of all reboots since the log file was created.less

Finding systems last shutdown date and time

To display last shutdown date and time use the following command:
$ last -x|grep shutdown | head -1
Sample outputs:spa

shutdown system down  2.6.15.4         Sun Apr 30 13:31 - 15:08  (01:37)

Where,code

  • -x: Display the system shutdown entries and run level changes.

Here is another session from my last command:
$ last
$ last -x
$ last -x reboot
$ last -x shutdown
io

相關文章
相關標籤/搜索