32

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?

2 Answers 2

32

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.

1
  • 2
    or /etc/bash.bashrc alternate for system-wide config
    – reukiodo
    Mar 18, 2021 at 21:07
22

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.

1
  • 1
    +1, but isn't there a better, that is, more principled - Ubuntu style for this? U often puts another layer of config on top of it.
    – false
    Mar 17, 2013 at 0:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .