Find last shutdown time

logsshutdowntime

This is the command I am using:

last -x|grep shutdown | head -1

but it's giving me the duration with +2 hours:

shutdown system down  3.14-1-amd64     Mon Jul 21 08:43 - 22:19  (13:36)

the last shutdown time (08:43) is correct, but the startup time (22:19, should be 20:19) is incorrect.

Is there a better command to check how long ago the PC was shutdown? or is my DST settings or something else causing this?

PS: I am using Debian testing (Linux rig 3.14-1-amd64 #1 SMP Debian 3.14.12-1 (2014-07-11) x86_64 GNU/Linux)

Best Answer

According to your output:

shutdown system down  3.14-1-amd64     Mon Jul 21 08:43 - 22:19  (13:36)

You shutdown your system on July 21 at 08:43 and then after 13 hours and 36 minutes on July 21 at 22:19 you boot it up again. You can see how much time your system is up with uptime command. If you want to see the last time you boot up (not shutdown) use the following command:

 last -x | grep reboot

For example my output is:

reboot   system boot  4.4.0-31-generic Mon Aug  1 12:59   still running
reboot   system boot  4.4.0-31-generic Mon Aug  1 01:28 - 08:54  (07:25)

Now it's easy to understand that I booted up my system on August 1 at 12:59 and it's still running. And I was working with my computer for 7 hours and 25 minutes from 01:28 to 08:54 on August 1. Hope it will be useful! :-)

Related Question