Difference between `ls -c` and `ls -t`

fileslstimestamps

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?

Best Answer

-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.

Related Question