35 Practical Examples of Linux Find Command

If you have any questions or problems regarding this article and want help within 24 Hours? Ask Now

Ravi Saive

Simple Word a Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

Receive Your Free Complimentary eBook NOW! -

Download Free Linux eBooks

Advanced Bash-Scripting Guide
Linux Bible
A Newbie's Getting Started Guide to Linux
Ubuntu Linux Toolbox: 1000+ Commands

You may also like...

57 Responses

  1. Bharatdan Gadhavi says:

    Hi Ravi,

    I got result in SSH with one of find syntax.
    But I got too many results which I can not see all in SSH window.
    Can you suggest any syntax using which I can store all search result in any text file or something and I can have look at that file later on when needed?

    • Ravi Saive says:

      Use following example command to store all data about find command on a file.

      find / -name *.abc >> somefile.txt
  2. bapu says:

    Hello sir,

    Superb explantion. Very helpful. Many thanks

  3. Dimitris Maraidonis says:

    You can also use this
    find . -type f -name “tecmint.txt” -delete
    instead of this
    find . -type f -name “tecmint.txt” -exec rm -f {} \;

  4. Neil Niekerk says:

    The content is excellent at TecMint, but the pages cannot be saved/printed usefully. I save all web-urls in .pdf. Tecmint pages are useless to print.

  5. Marcos Vinicius Linhares says:

    I think you can improve your Part IV with this: http://serverfault.com/a/122831

  6. Rahul Kumar says:

    Another solution is :
    find . -name -exec mv {} \;

  7. sunny desouza says:

    quick question :-

    How do we find a file and then we rename (mv) the same file with one command
    Does -exec option work with it ?

    Any Examples ?

  8. sunny desouza says:

    Dear Tecmints ,

    i understand that this works for one of the files to find apply the execute the action on those files

    $ find / -name “error_*.txt” -exec ls -lrathi ‘{}’ “;”

    but can you please provide examples on multiple files how do we do it ?

    Examples : – if there are “find_*.txt” “list_*.csv” and more

    • Dear techmint ,

      I want to find and remove multiple files such as .mp3 or .txt, then use.

      But first i want to list it first , so i fire the below command.
      And i notice that when you try to find a pattern of files

      Example : “*.txt” , “*.tar” , “*.csv”

      as per the command All of them do not give me the out put
      Where as only the last pattern “*.csv” , gives me the output .
      Please advise , how i can get out put of : -“*.txt” , “*.tar” also in my find result

      find / -type f -name “*.txt” -o -name “*.tar” -o -name “*.csv” -exec ls -larthi ‘{}’ “;”

      1376260 -rw-r–r– 1 root root 118 Aug 17 2007 /usr/share/alsa/speaker-test/sample_map.csv

      [root@localhost ~]#


Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Join Over 80000+ Linux Users
  1. 52882
  2. 2763
  3. 18,639

Enter your email to get latest Linux Howto's