How To Find The Oldest File In A Directory Tree In Linux

Find The Oldest File In A Directory Tree In Linux

4 Responses

  1. gocyclones says:

    ls -lt | tail -1 Oldest
    ls -ltr | tail -1 Newest

  2. Bro. Vin says:

    Will List 20 newest files>>> ls -ltr | tail 20
    Will List 20 oldest files>>> ls -ltr | head 20

  3. Joshua Sweet Koebler says:

    Never ever use the output of ls in a script, as its behavior is unpredictable when the filenames contain whitespaces or weird characters such as line breaks.
    So if you need to use the file name in a script, then don’t use ls. Use find.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.