issues "using ls -al --full-time" in OSX

C0ppert0p picture C0ppert0p · Mar 8, 2013 · Viewed 14.8k times · Source

--full-time is a handy little option for ls but it doesn't work when used in a batch file.

ls -al --full-time when used at the command prompt yields a an expanded date and time:

2012-01-16 18:56:00.000000000

used in a bash script I got this:

ls: illegal option -- - usage: ls [-ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1] [file ...]

is there any way around this.

Answer

Peixu Zhu picture Peixu Zhu · Mar 8, 2013

for native ls command, option -T seems to be the alternative of --full-time, and it expands to seconds, example as below:

>$  ls -lT
-rw-r--r--   1 raison staff     197 Feb 14 09:12:56 2013 1.c
-rw-r--r--   1 raison staff    1174 Mar  8 09:34:49 2013 1.s
-rw-r--r--   1 raison staff     993 Feb  5 14:44:09 2013 1.x86.s