First let's go over the following commands.
To show the creation time of a file:
ls -l --time=status --full-time some-file.txtTo show the access time of a file:
ls -l --time=access --full-time some-file.txtNext we'll look at how to display the files in a certain chronological order based on file access or create time.
Show files in descending order of file access time.
In other words, show latest file first. Sort files in reverse chronological order based on file access time, or sort files from latest to oldest. "access" includes read or write it with any tool such as vi.
$ ls -lt --time=access --full-time |more total 3397740 -rwxrwxrwx 1 www-data www-data 55752 2015-11-13 15:31:50.000000000 +0800 some-file.txt -rwxrwxrwx 1 www-data www-data 43643 2015-11-13 15:31:47.000000000 +0800 some-file2.txt ...If you want to sort files in descending order of file creation time, simply replace "access" with "status" like the following:
$ ls -lt --time=status --full-time |more
Show files in ascending order of file access time.
In other words, show oldest file first. Sort files in chronological order based on file access time, or sort files from oldest to latest. "access" includes read or write it with any tool such as vi.
$ ls -ltr --time=access --full-time |more total 3397892 -rwxrwxrwx 1 www-data www-data 46375 2015-10-21 12:05:19.088000000 +0800 some-file3.txt -rwxrwxrwx 1 www-data www-data 46588 2015-10-21 12:28:58.300000000 +0800 some-file4.txt ...If you want to sort files by file creation time, simply replace "access" with "status".
Questions? Let me know!