7

It annoys me that sometimes when I run ls -l on a folder it reports the date and time for some files and only the date and year for others.

$ ls -ltr
-rw-r--r-- 1 oracle9 dba  173 Dec 22 09:49 a1.par
-rw-r--r-- 1 oracle9 dba  191 Dec 22 09:49 a2.par
-rw-r--r-- 1 oracle9 dba  185 Dec 22 09:49 a3.par
-rw-r--r-- 1 oracle9 dba  497 Dec 22 09:49 a4.par
-rw-r--r-- 1 oracle9 dba  238 Dec 22 09:49 a5.par
-rw-r--r-- 1 oracle9 dba  260 Dec 22 09:49 a6.par
-rwxr-x--- 1 oracle9 dba 1076 Dec 22 09:49 al.sh
-rwxr-x--- 1 oracle9 dba  931 Dec 22 09:49 im.sh
-rwxr-x--- 1 oracle9 dba  982 Dec 22 09:49 mt.sh
drwxr-xr-x 2 oracle9 dba 4096 Dec 22 09:49 comp
drwxr-xr-x 2 oracle9 dba 4096 Dec 22 10:08 scr
-rw------- 1 oracle9 dba    0 Dec 22 10:25 nohup.out
-rw-r--r-- 1 oracle9 dba    0 Dec 22 10:25 start
-rw-r--r-- 1 oracle9 dba    0 Dec 22 10:25 start2
-rw-r--r-- 1 oracle9 dba 5587 Dec 22  2016 g2.log
-rw-r--r-- 1 oracle9 dba 5725 Dec 22  2016 g2.out
-rw-r--r-- 1 oracle9 dba    0 Dec 22  2016 t6.log
-rw-r--r-- 1 oracle9 dba    0 Dec 22  2016 start6
-rw-r--r-- 1 oracle9 dba    0 Dec 22  2016 g6.log
-rw-r--r-- 1 oracle9 dba  781 Dec 22  2016 t2.log
-rw-r--r-- 1 oracle9 dba  730 Dec 22  2016 g6.out

Notice that it doesn't show the time for the last 7 files in the list, and that it doesn't show the year for the first 14 files.

This behavior is not always reproducible.

  • How can this be avoided?
  • Shouldn't the date/time format be consistent within the same list by default?

The OS is Red Hat 6.4

Mehdi Charife
  • 143
  • 11
Tulains Córdova
  • 2,926
  • 4
  • 18
  • 26

1 Answers1

16

The files listed with year have their modification dates in the future.

You can use the --full-time option to display the complete date.

Mehdi Charife
  • 143
  • 11
Ipor Sircer
  • 14,376
  • 1
  • 27
  • 34