문제

How to list most recently modified max N (such as 5) files in bash?

I used

ls -alt 

or

find -mtime 0

to show the recently files but I don't know how to limit the result into 5 records. Maybe find or some other command can be followed in command pipe?

도움이 되었습니까?

해결책

You can use head or tail to limit the number oflines in a pipie:

ls -latr | tail -n5
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top