Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»Linux Commands»How to Search Recently Modified Files in Linux

    How to Search Recently Modified Files in Linux

    By RahulFebruary 16, 20222 Mins Read

    This tutorial will help you to find recently modified files in Linux via command line .

    Advertisement

    The find command allows us to define duration in Minutes or Days. The minutes are define with -mmin and the days value can be defined with -mtime

    You can also define the search criteria to find files modified within or before specified duration. For example, to search files modified before, use “+” (positive) with duration (eg: +1, +24 etc). To search files modified within duration use “-” (negative) sign with duration value (eg: -1, -24) etc.

    Find All Modified Files Less Than Time

    1. Modified within 10 Minutes:- Search all files modified within 10 minutes in the current directory. Use -mmin -10 means the files last modified less than 10 minutes.
      find . -type f -mmin -10 
      
    2. Modified within 2 Hours:- Find all files modified within 2 hours in the current directory. Use -mmin -120 means the files last modified less than 120 minutes ie equal to 2 hours.
      find . -type f -mmin -120 
      
    3. Modified within 1 day:- Search all files modified within 24 hours in the current directory. To define range in days use -mtime. For example -mtime -1 means the files last modified les than 24 hours ago.
      find . -type f -mtime -1 
      

    Find All Modified Files Before Time

    The above example, find all file modified within specified duration. But you can also search files modified before specified duration with the help of below examples.

    1. Modified older than 10 Minutes:- Search all files modified before 10 minutes in the current directory. Use -mmin +10 option, which means find all files modified more than 10 minutes ago.
      find . -type f -mmin +10 
      
    2. Modified older than 2 Hours:- Find all files modified before 2 hours in the current directory. Use -mmin +120 options to search file modified older than 120 minutes (ie 2 hours).
      find . -type f -mmin +120 
      
    3. Modified older than 1 day:- Search all files modified more than 24 hours ago in the current directory. You can use -mtime option to define duration in days. For example -mtime +1 means find all files modified before 24 hours.
      find . -type f -mtime +1 
      

    files find
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    Uptime Command in Linux

    A Quick Reference Guide to Uptime Command in Linux

    What are the Sparse Files?

    fallocate Command in Linux (Allocate the Space for a File)

    fallocate Command in Linux (Allocate the Space for a File)

    Add A Comment

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • 20 Basic Linux Commands for the Beginners (Recommended)
    • tail Command in Linux with Examples
    • What is a Orphan Process in Unix/Linux
    • How To Display Warning Message to Unauthorized SSH Access
    • How to Set a Custom SSH Login Banner and MOTD
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.