179

Something annoying about ls -l command is it shows only hour and minute for a file(like 08:30). How can I see the second portion(like 08:30:44)?

man 1 ls and search for 'second' does not give any clue.

191

Does your version of ls support the --time-style option? If so:

ls -la --time-style=full-iso blah

-rw-r--r-- 1 root root 0 2011-11-08 18:02:08.954092000 -0700 blah
  • 6
    Yes, thanks, even on a old Mandrake Linux 10.0 from year 2005. --full-time OK as well. – Jimm Chen Nov 9 '11 at 2:08
  • 1
    or "ls -ale" (only this worked for me on an older linux distro) – mBardos Jul 20 '16 at 13:02
  • 11
    Mac OSX equivalent: ls -lT – MarkHu Jan 25 '17 at 0:49
  • What is the difference between --time-style=full and --time-style=full-iso? – neverMind9 Jun 10 at 14:51
94

The more simple way is:

ls --full-time

which is equal to

ls -l --time-style=full-iso

If you want to show entries as hidden files starting with ., add -a:

ls --full-time -a
  • What is the difference between --time-style=full and --time-style=full-iso? – neverMind9 Jun 10 at 14:50
37

For OS X, it looks like the best you get is:

ls -l -T

From the ls(1) manpage on 10.10.5:

-T When used with the -l (lowercase letter ``ell'') option, display complete time information for the file, including month, day, hour, minute, second, and year.

  • 3
    Or like this: ls -lT. – jox Jun 8 '17 at 21:19
  • this also works in Windows/Ubuntu – Michael Jul 22 '17 at 17:11
20

An alternative to the approved answer - you can use a custom format like in the date command if "--time-style=full-iso" output is too detailed for you:

ls -l --time-style=+"%b %d %Y %H:%M:%S" blah
-rw-rw-r-- 1 root root 0 Feb 03 2014 01:13:01 blah
3

Regarding to man ls instructions simply ls -e works fine !

  • 3
    Which version of GNU coreutils do you use? With 8.20 I don't have this parameter. – sebix Nov 29 '14 at 11:36
  • 1
    Version please :) – hakre Aug 6 '15 at 7:31
  • When using GNU coreutils 8.22 ls there is no -e option. I suspect the version of ls you have is Darwin based. – Elijah Lynn Aug 21 '16 at 11:09
  • 1
    BusyBox. Embedded Linuxes. Yes. Try -e if these other (GNU based) flags fail. – Steven Lu Jan 5 '17 at 17:04
1

For FreeBSD, it would be:

ls -la -D %Y-%m-%dT%H:%M:%S

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.