13

How do I get the ls command to show its dates and times in UTC, instead of localtime?

I don't want to permanently change the local time for my system to do this.

17

One can set the time zone environment variable for each invocation of ls like so:

TZ=utc ls -l

or set it once with:

export TZ=utc

in a shell to have it always on, for the remaining duration of the shell session.

| improve this answer | |
  • 5
    Worth noting that ls -l --full-time will display the full time in ISO format with the offset from UTC. – oranja May 30 '17 at 8:40
0

Please try this command

To force UTC, simply set $TZ to UTC: TZ="UTC" ls . This will set $TZ to UTC just for the duration of this command.

| improve this answer | |

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.