How to find files in linux

Need to find files older than certain time frame? This will help, “find [dir] -type f -mtime +[24hours*n] ”

Examples,

Show files older than 7 days

find /tmp/ -type f -mtime +7

Show files older than 7 days and rm them.

find /tmp/ -type f -mtime +7 -exec rm {} \;

or if you have a large number of files

find /tmp/ -type f -mtime +7 | xargs rm

2 Responses to “How to find files in linux”

Author comments are in a darker gray color for you to easily identify the posts author in the comments

  1. hongkiat says:

    Nice little tricks, saving them to my routine use list :-)

  2. josh says:

    .

    Search for files on Linux quickly using the command line:

    article:
    http://www.codetechnical.com/linux/search-for-a-file-in-linux.html

    .

Leave a Reply

© 2008-2009 The Danesh Project
Powered by Wordpress and made by Guerrilla. Best viewed in Mozilla Firefox