ls command

In Linux, RH 6.x, how do I specify the ls command such that the files that were most recently edited are displayed at the end of the list ?

Anthony LuciaAsked:
Who is Participating?
woolmilkporcConnect With a Mentor Commented:
ls -rt


ls -rtl

(long output format)
Yeah ls -tr (last modified in reverse order)
Shiju JacobInfo SecurityCommented:
Try using head or tail. If you want the 5 most-recently modified files:

ls -1t | head -5

The -1 (that's a one) says one file per line and the head says take the first 5 entries.

If you want the last 5 try

ls -1t | tail -5
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.