Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

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

What is the difference between -c and -t options for the ls Unix command? And how can I sort by date of creation with the ls command?

share|improve this question
up vote 5 down vote accepted

-t lists the file's modification time, which is the last time the file's content was modified (unless the modification time was explicitly set afterwards).

-c lists the file's inode change time, which is the last time the file's metadata was changed (ownership, permissions, etc.) or the file was moved.

Most unix systems do not track the creation date of a file, so most ls implementations don't offer a way to sort by this non-existent timestamp. Under OSX, use ls -tU.

See also How do I do a ls and then sort the results by date created? for more information.

share|improve this answer
Isn't the change of repertory of a file writen in the metadatas? – user3581976 Jul 19 '14 at 0:19
@user3581976 No, moving a file doesn't change any of its metadata as such. It only modifies the old directory and the new directory. But it's considered a metadata change anyway: the ctime is updated. – Gilles Jul 19 '14 at 0:23
But the ctime is written in the ext2_inode struct, isn't it? – user3581976 Jul 19 '14 at 0:24
@user3581976 Yes, but what does this have to do with moving a file? – Gilles Jul 19 '14 at 0:26

From the GNU manpage

-t     sort by modification time, newest first
-c     with -lt: sort by, and show, ctime (time of last modification of
          file  status  information)  with -l: show ctime and sort by name
          otherwise: sort by ctime, newest first

When -c is used with -lt, it will show and sort by file ctimes (instead of modification times). Whether or not your OS records file ctime's depends on the filesystem being used.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.