ls to show dates and times in UTC

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.


Solution 1:

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.

Solution 2:

To force UTC, set $TZ to UTC:

TZ="UTC" ls <options>

This will set $TZ to UTC just for the duration of this command.