How to sort the files according to the time stamp in unix? I need to sort the files and also based on time they created.
Asked
Active
Viewed 1.4e+01k times
96
-
1Which timestamp? Also, there is no creation timestamp on most *nix filesystems. – ninjalj May 16 '11 at 21:38
-
1time stamp with which the file is created. – Srihari May 16 '11 at 21:39
-
try `ls -Ct | awk '{print $1}'` – zx1986 Nov 04 '16 at 14:47
2 Answers
176
File modification:
ls -t
Inode change:
ls -tc
File access:
ls -tu
"Newest" one at the bottom:
ls -tr
None of this is a creation time. Most Unix filesystems don't support creation timestamps.

ninjalj
- 42,493
- 9
- 106
- 148
-
4Actually, many *nix filesystems do support creation timestamp… it's just not cross-platform. On FreeBSD and OS X, it's generally only available on native BSD filesystems (including HFS+ on OS X); it's called "file creation time", and `ls -U` sorts by it. On Linux, it's available on most filesystems that support it (even including NTFS), but it's called "birth time", and you have to sort manually. – abarnert Nov 06 '14 at 05:02