coreutils: Formatting file timestamps

1 
1 10.1.6 Formatting file timestamps
1 ---------------------------------
1 
1 By default, file timestamps are listed in abbreviated form, using a date
1 like ‘Mar 30  2002’ for non-recent timestamps, and a date-without-year
1 and time like ‘Mar 30 23:45’ for recent timestamps.  This format can
1 change depending on the current locale as detailed below.
1 
1    A timestamp is considered to be “recent” if it is less than six
1 months old, and is not dated in the future.  If a timestamp dated today
1 is not listed in recent form, the timestamp is in the future, which
1 means you probably have clock skew problems which may break programs
1 like ‘make’ that rely on file timestamps.  ⇒File timestamps.
1 
1    Timestamps are listed according to the time zone rules specified by
1 the ‘TZ’ environment variable, or by the system default rules if ‘TZ’ is
1 not set.  ⇒Specifying the Time Zone with ‘TZ’ (libc)TZ Variable.
1 
1    The following option changes how file timestamps are printed.
1 
1 ‘--time-style=STYLE’
1      List timestamps in style STYLE.  The STYLE should be one of the
1      following:
1 
1      ‘+FORMAT’
1           List timestamps using FORMAT, where FORMAT is interpreted like
1           the format argument of ‘date’ (⇒date invocation).  For
1           example, ‘--time-style="+%Y-%m-%d %H:%M:%S"’ causes ‘ls’ to
1           list timestamps like ‘2002-03-30 23:45:56’.  As with ‘date’,
1           FORMAT’s interpretation is affected by the ‘LC_TIME’ locale
1           category.
1 
1           If FORMAT contains two format strings separated by a newline,
1           the former is used for non-recent files and the latter for
1           recent files; if you want output columns to line up, you may
1           need to insert spaces in one of the two formats.
1 
1      ‘full-iso’
1           List timestamps in full using ISO 8601-like date, time, and
1           time zone components with nanosecond precision, e.g.,
1           ‘2002-03-30 23:45:56.477817180 -0700’.  This style is
1           equivalent to ‘+%Y-%m-%d %H:%M:%S.%N %z’.
1 
1           This is useful because the time output includes all the
1           information that is available from the operating system.  For
1           example, this can help explain ‘make’’s behavior, since GNU
1           ‘make’ uses the full timestamp to determine whether a file is
1           out of date.
1 
1      ‘long-iso’
1           List ISO 8601 date and time components with minute precision,
1           e.g., ‘2002-03-30 23:45’.  These timestamps are shorter than
1           ‘full-iso’ timestamps, and are usually good enough for
1           everyday work.  This style is equivalent to ‘+%Y-%m-%d %H:%M’.
1 
1      ‘iso’
1           List ISO 8601 dates for non-recent timestamps (e.g.,
1           ‘2002-03-30 ’), and ISO 8601-like month, day, hour, and minute
1           for recent timestamps (e.g., ‘03-30 23:45’).  These timestamps
1           are uglier than ‘long-iso’ timestamps, but they carry nearly
1           the same information in a smaller space and their brevity
1           helps ‘ls’ output fit within traditional 80-column output
1           lines.  The following two ‘ls’ invocations are equivalent:
1 
1                newline='
1                '
1                ls -l --time-style="+%Y-%m-%d $newline%m-%d %H:%M"
1                ls -l --time-style="iso"
1 
1      ‘locale’
1           List timestamps in a locale-dependent form.  For example, a
1           Finnish locale might list non-recent timestamps like ‘maalis
1           30  2002’ and recent timestamps like ‘maalis 30 23:45’.
1           Locale-dependent timestamps typically consume more space than
1           ‘iso’ timestamps and are harder for programs to parse because
1           locale conventions vary so widely, but they are easier for
1           many people to read.
1 
1           The ‘LC_TIME’ locale category specifies the timestamp format.
1           The default POSIX locale uses timestamps like ‘Mar 30  2002’
1           and ‘Mar 30 23:45’; in this locale, the following two ‘ls’
1           invocations are equivalent:
1 
1                newline='
1                '
1                ls -l --time-style="+%b %e  %Y$newline%b %e %H:%M"
1                ls -l --time-style="locale"
1 
1           Other locales behave differently.  For example, in a German
1           locale, ‘--time-style="locale"’ might be equivalent to
1           ‘--time-style="+%e. %b %Y $newline%e. %b %H:%M"’ and might
1           generate timestamps like ‘30. Mär 2002 ’ and ‘30. Mär 23:45’.
1 
1      ‘posix-STYLE’
1           List POSIX-locale timestamps if the ‘LC_TIME’ locale category
1           is POSIX, STYLE timestamps otherwise.  For example, the
1           ‘posix-long-iso’ style lists timestamps like ‘Mar 30  2002’
1           and ‘Mar 30 23:45’ when in the POSIX locale, and like
1           ‘2002-03-30 23:45’ otherwise.
1 
1    You can specify the default value of the ‘--time-style’ option with
1 the environment variable ‘TIME_STYLE’; if ‘TIME_STYLE’ is not set the
1 default style is ‘locale’.  GNU Emacs 21.3 and later use the ‘--dired’
1 option and therefore can parse any date format, but if you are using
1 Emacs 21.1 or 21.2 and specify a non-POSIX locale you may need to set
1 ‘TIME_STYLE="posix-long-iso"’.
1 
1    To avoid certain denial-of-service attacks, timestamps that would be
1 longer than 1000 bytes may be treated as errors.
1