manpagez: man pages & more
info coreutils
Home | html | info | man

File: coreutils.info,  Node: Sorting the output,  Next: General output formatting,  Prev: What information is listed,  Up: ls invocation

10.1.3 Sorting the output
-------------------------

These options change the order in which ‘ls’ sorts the information it
outputs.  By default, sorting is done by character code (e.g., ASCII
order).

‘-c’
‘--time=ctime’
‘--time=status’
     In long format, print the status change timestamp (the ctime)
     instead of the mtime.  When sorting by time or when not using long
     format, sort according to the ctime.  *Note File timestamps::.

‘-f’
     Produce an unsorted directory listing.  This is equivalent to the
     combination of ‘--all’ (‘-a’), ‘--sort=none’ (‘-U’), ‘-1’,
     ‘--color=none’, and ‘--hyperlink=none’, while also disabling any
     previous use of ‘--size’ (‘-s’).

‘-r’
‘--reverse’
     Reverse whatever the sorting method is – e.g., list files in
     reverse alphabetical order, youngest first, smallest first, or
     whatever.  This option has no effect when ‘--sort=none’ (‘-U’) is
     in effect.

‘-S’
‘--sort=size’
     Sort by file size, largest first.

‘-t’
‘--sort=time’
     Sort by modification timestamp (mtime) by default, newest first.
     The timestamp to order by can be changed with the ‘--time’ option.
     *Note File timestamps::.

‘-u’
‘--time=atime’
‘--time=access’
‘--time=use’
     In long format, print the last access timestamp (the atime).  When
     sorting by time or when not using long format, sort according to
     the atime.  *Note File timestamps::.

‘--time=mtime’
‘--time=modification’
     This is the default timestamp display and sorting mode.  In long
     format, print the last data modification timestamp (the mtime).
     When sorting by time or when not using long format, sort according
     to the mtime.  *Note File timestamps::.

‘--time=birth’
‘--time=creation’
     In long format, print the file creation timestamp if available,
     falling back to the file modification timestamp (mtime) if not.
     When sorting by time or when not using long format, sort according
     to the birth time.  *Note File timestamps::.

‘-U’
‘--sort=none’
     Do not sort; list the files in whatever order they are stored in
     the directory.  (Do not do any of the other unrelated things that
     ‘-f’ does.)  This can be useful when listing large directories,
     where sorting can take some time.

‘-v’
‘--sort=version’
     Sort by version name and number, lowest first.  It behaves like a
     default sort, except that each sequence of decimal digits is
     treated numerically as an index/version number.  *Note Version sort
     ordering::.

‘--sort=width’
     Sort by printed width of file names.  This can be useful with the
     ‘--format=vertical’ (‘-C’) output format, to most densely display
     the listed files.

‘-X’
‘--sort=extension’
     Sort directory contents alphabetically by file extension
     (characters after the last ‘.’); files with no extension are sorted
     first.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.