0

Is there a way to tell this command to output the data in local time (not UTC)?

last reboot

Version:

last --version
last von util-linux 2.27.1
  • 1
    Does last reboot not honour the TZ environment variable? I don't have any machines that have rebooted since the start of wtmp, but certainly logins and the wtmp start date are printed according to TZ ("last from util-linux 2.28.1"). E.g. TZ=UTC last reboot or TZ=Australia/Perth last reboot. – Toby Speight Aug 24 '16 at 15:31
2

Use TZ if you need some (troublesome on account of the horrible daylight savings time swings) local timezone, as @Toby indicates:

% TZ=US/Pacific last | sed -n /reboot/p | sed -n 1p
reboot   system boot  2.6.32-642.1.1.e Mon Jul 25 09:55 - 08:47 (29+22:51)  
% last | sed -n /reboot/p | sed -n 1p 
reboot   system boot  2.6.32-642.1.1.e Mon Jul 25 16:55 - 15:47 (29+22:51)  
%

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.