Listing the Newest Files
Files can be used through displaying the most recently changed or created files first, through using the ls -t command.
Here
# ls -t [directory]
-t - sorts listings through latest time stamp first and
Directory - refers to the directory which is to be searched.
Consider the given example to listing the newest files
The given example displays how to use ls -t to locate the most present files inside the /var/adm directory. sulog, messages, , and lastlog were made or edited most recently. That is verified using output from ls -l, which displays that these three files were created or edited in March, although the other files in /var/spool were edited or created earlier.
# ls -t /var/adm
sulog wtmpx wtmp messages.11 vold.log spellhist
messages utmp sa messages.12 log aculog
utmpx lastlog messages.10 messages.13 acct passwd
# ls -l /var/adm
total 686
drwxr-xr-x 5 adm adm 512 Feb 14 16:20 acct
-rw--- 1 uucp bin 0 Feb 14 16:04 aculog
-r-r-r- 1 root other 8456 Mar 28 10:34 lastlog
drwxr-xr-x 2 adm adm 512 Feb 14 16:36 log
-drwxr-xr-x 2 adm adm 512 Feb 14 16:03 passwd
drwxr-xr-x 2 adm sys 512 Mar 21 06:59 sa