Long list file display different time format.

Hi Gurus,

I have some weird issue. when using

ls -l 

the result shows different time format:

-rw-r--r--   1 abc    gourp1   3032605576 Jun 14  2013 abc
-rw-rw-r--   1 abc    gourp1   1689948832 Aug 10 06:22 abc

one display 2013 which is year; another one displays 06:22 which is time.

how can I fix this issue.

Thanks in advance.

There is nothing to fix; that is the way ls is designed to work. For dates more than six months in the past and for dates in the future, it prints the year. For dates within the past six months, it prints the timestamp.

This is standard ls functionality, older dates need the year and drop time info.

Many ls implementations let you specify your own time style eg:

$ ls -l --time-style="+%Y/%m/%d %T"
-rw-r--r-- 1 abc    gourp1    3032605576  2013/06/14 19:56:00 abc
-rw-r--r-- 1 abc    gourp1    1689948832  2013/08/10 06:22:13 def
1 Like

We discussed similar topic in your previous thread

You can use:

Option  Format
------  ---------------------------------
-e      mmm dd hh:mm:ss yyyy
-E      yyyy-mm-dd hh:mm:ss.nnnnnnnnn

E.g.

$ ls -e file
-rw-r--r--   1 yoda yoda 19 Nov 12 08:29:56 2013 file
$ ls -E file
-rw-r--r--   1 yoda yoda 19 2013-11-12 08:29:56.000000000 -0800 file
2 Likes

Thank you very much.