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.
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communityDoes 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
--time-style=full
and --time-style=full-iso
?
Jun 10, 2019 at 14:51
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
--time-style=full
and --time-style=full-iso
?
Jun 10, 2019 at 14:50
full
to full-iso
. Same happens e.g. to f
. It does not work for l
or lo
, because they could be long-iso
or locale
. But lon
will expand to long-iso
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.
-D
option which was inherited from BSD and has been there forever.
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
On BusyBox systems, ls -e
works fine!
ls
there is no -e
option. I suspect the version of ls
you have is Darwin based.
Aug 21, 2016 at 11:09
-e
if these other (GNU based) flags fail.
Jan 5, 2017 at 17:04
For BSD systems including FreeBSD and macOS, it would be:
ls -la -D '%Y-%m-%dT%H:%M:%S'
ls -l
shows second...for even higher granularity see some of the answers here... :")