How to make ls produce ISO 8601 format
In older versions of Ubuntu, like 9.10, ls(1)
produced ISO 8601 format by default, in the way
ls -l --time-style=long-iso
does it. With 12.04, we're back at the older Unix style. Thus replacing the year by minutes and seconds for recent dates.
How can I - in the least intrusive manner change this back to long-iso
? Is there maybe some general configuration option?
I know this question is quite old (more than 1 year old), but for posterity, let me share the tip as originally described in this blog post (not mine). In summary, this one line does everything you want:
export TIME_STYLE=long-iso
stick that line into /etc/profile
, or a file in /etc/profile.d/
, or even in ~/.bashrc
, and you're good to go.
I was convinced that ls
took its default arguments from the environment variable LS_OPTIONS
, but its man page makes no mention of this.
My solution would be to set an alias to ls
in ~/.bash_aliases
or ~/.bashrc
:
alias ls='ls --time-style=long-iso'
Which instantly makes it work for the common ll
alias as well.