How to view the last created file?

I downloaded the file to a Linux computer. I do not know his name. So how to view files through their last date attribute?

+5
source share
3 answers
ls -lat

displays a list of all files sorted by date. When enumerated with the -l flag using the -t flag, sorts by date. If you only need the file name (possibly for a script), try something like:

ls -lat | head -2 | tail -1 | awk '{print $9}'

Here all the files will be listed, as before, get the first 2 lines (the first will look like β€œonly 260”), get the last (the one that shows the details of the file), and then get the 9th column that contains the file name.

+6
source
find / -ctime -5

, . , .

+8

Use ls -lUtor ls -lUtras you wish. You can take a look at the team documentation by lstyping man lson the terminal.

0
source

All Articles