scripting - get specific file from sorted files -


meybe simple im new on unix.

i have directory /home , in directory have 5 files ;

/home/file1.csv

/home/file2.csv

/home/file3.csv

/home/file4.csv

/home/file5.csv

i want display file , must ordered date , can display example 3.file order ..

i'm not sure if want ordered newest first or oldest first.

ls -t | head -3 

will print newest 3 files, and

ls -rt | head -3 

will print oldest 3 files.

and if want sort result in access time (the commands above sort them in modification time), please use following commands respectively.

ls -u | head -3 ls -ru | head -3 

Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -