Make “ls” output date in long iso format instead of short month

On my Debian Testing laptop (Wheezy with GNU coreutils 8.5), "ls" output defaults to a short month date format (e.g. Aug 3 13:21), which I loathe. I much prefer the long ISO date format (e.g. 2011-08-03 13:21), which is default in Debian Stable (Squeeze with GNU coreutils 6.10). Not sure why this changed, but an alias in ~/.bashrc provides quick and much needed relief.

Add to .bashrc:

alias ll='ls -lh --time-style long-iso'

Source it and enjoy.

Awful:

ls -l /usr
total 228
drwxr-xr-x   2 root root  69632 Aug  3 13:21 bin
drwxr-xr-x   2 root root   4096 May 24 01:18 games
drwxr-xr-x  40 root root  16384 Jul 25 16:37 include
drwxr-xr-x 225 root root  69632 Aug  8 12:46 lib
drwxr-xr-x   4 root root  28672 Jun  5 16:38 lib32
lrwxrwxrwx   1 root root      3 May  5 19:41 lib64 -> lib
drwxrwsr-x  10 root staff  4096 May  5 19:41 local
drwxr-xr-x   2 root root  12288 Aug  3 13:21 sbin
drwxr-xr-x 347 root root  12288 Aug  3 13:21 share
drwxr-xr-x   5 root root   4096 Aug  2 18:00 src

Great:

ll /usr
total 228K
drwxr-xr-x   2 root root   68K 2011-08-03 13:21 bin
drwxr-xr-x   2 root root  4.0K 2011-05-24 01:18 games
drwxr-xr-x  40 root root   16K 2011-07-25 16:37 include
drwxr-xr-x 225 root root   68K 2011-08-08 12:46 lib
drwxr-xr-x   4 root root   28K 2011-06-05 16:38 lib32
lrwxrwxrwx   1 root root     3 2011-05-05 19:41 lib64 -> lib
drwxrwsr-x  10 root staff 4.0K 2011-05-05 19:41 local
drwxr-xr-x   2 root root   12K 2011-08-03 13:21 sbin
drwxr-xr-x 347 root root   12K 2011-08-03 13:21 share
drwxr-xr-x   5 root root  4.0K 2011-08-02 18:00 src

2 Comments

  • 1. Contemporary replies at 27th May 2013, 6:23 pm :

    You could also do (changes the default date format used):

    export TIME_STYLE=long-iso
  • 2. Adrian von Grueningen replies at 1st March 2015, 8:26 am :

    Beatiful. Worked lika charm. Just wish I’ve looked into this earlier. Like a few years ago… Oh, well. :-)

Leave a comment

NOTE: Enclose quotes in <blockquote></blockquote>. Enclose code in <pre lang="LANG"></pre> (where LANG is one of these).