Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Linux Commands»How to Search Files Created Before X Days in Linux

    How to Search Files Created Before X Days in Linux

    RahulBy RahulAugust 1, 20191 Min ReadUpdated:September 13, 2019

    This tutorial will help you to find files created or modified before X days. Here X means any number (eg: 1,2 or 30). Using find command you can also search which is created or modified before X minutes.

    1. Search files created/modified before 30 days

    Use this command to search all files created or modified before 30 days in /var/backup directory. Find provides the option -mtime to define number of days.

    find /var/backup -type f -mtime -30
    

    You can also search file created before 30 minutes using -mmin optiopn.

    find /var/backup -type f -mmin -30
    

    2. Search files with specific extension

    You can also search file for a specific extension. For example to search all files with extension “.log” under /var/log directory.

    find /var/log -name "*.log" -type f -mtime -30 
    

    Or search speficif extension file created before 30 minutes.

    find /var/log -name "*.log" -type f -mmin -30 
    

    The above command will show only files having a .log extension.

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Install PhantomJS on CentOS & Fedora
    Next Article How to use Comments in JSON

    Related Posts

    How to Search Recently Modified Files in Linux

    2 Mins Read

    Bash Printf Command

    Updated:December 23, 20212 Mins Read

    Tee Command in Linux with Examples

    4 Mins Read

    How to Scan Open Ports with Nmap

    5 Mins Read

    Handling filenames with spaces in Linux

    3 Mins Read

    How To Compare Two Files in Linux

    Updated:August 23, 20215 Mins Read

    Leave A Reply Cancel Reply

    Recent Posts
    • How to Install Ionic Framework on Ubuntu 22.04
    • What is the /etc/hosts file in Linux
    • How to Install Angular CLI on Ubuntu 22.04
    • How to Install Composer on Ubuntu 22.04
    • How to Create DMARC Record For Your Domain
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

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