Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I get the ls command to show an exact time?

share|improve this question
up vote 4 down vote accepted

Might depend on your disrto, but this argument for ls is available in Debian:

          with -l, show times using style STYLE: full-iso, long-iso,  iso,
          locale,  +FORMAT.   FORMAT is interpreted like `date'; if FORMAT
          is FORMAT1<newline>FORMAT2, FORMAT1 applies to non-recent  files
          and FORMAT2 to recent files; if STYLE is prefixed with `posix-',
          STYLE takes effect only outside the POSIX locale


man ls 

in from your command line

share|improve this answer
Superuser is easier than man. Thanks :) – ripper234 Oct 28 '10 at 11:44
--time-style and --full-time are specific to GNU ls, so they're available on every Linux (except some embedded distributions) and few other unices. – Gilles Oct 28 '10 at 23:41

As well as CaseyIT's solution, you can also use the --full-time option.

share|improve this answer

Your locale will affect the way ls displays that date and time.

My locale is en_US.UTF-8 and ls always displays hours and minutes when I use ls -l, for example. However, if I change my locale like this:

LC_TIME=C ls -l

files that are newer than six months old don't show a year, older than six months or are in the future don't display a time at all and do show the year. The C locale (aka the POSIX locale) reproduces the historical behavior of ls in this regard (I seem to recall that there were some additional subtleties, however).

share|improve this answer

In FreeBSD the -T flag does this

ls -alFT

-rwxrwxr-x 1 un un 4900 May 5 10:52:03 2013 custom-banner.js*

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .