The Computer Oracle

How to have Linux ls command show second in time stamp

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game 5 Looping

--

Chapters
00:00 How To Have Linux Ls Command Show Second In Time Stamp
00:27 Accepted Answer Score 318
00:46 Answer 2 Score 151
01:07 Answer 3 Score 54
01:37 Answer 4 Score 30
01:54 Answer 5 Score 5
02:05 Thank you

--

Full question
https://superuser.com/questions/355318/h...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#linux #ls

#avk47



ACCEPTED ANSWER

Score 318


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



ANSWER 2

Score 151


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



ANSWER 3

Score 54


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.




ANSWER 4

Score 30


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



ANSWER 5

Score 5


On BusyBox systems, ls -e works fine!