LKBEN11012: Howto use the find command under linux

This article has not been checked!

LKB | Created: 02/04/2020 | Version: 0 | Language: EN | Rating: 0 | Outdated: False | Marked for deletion: False

Author: Wim Peeters - Keskon GmbH & Co. KG


You need to find files easily




Here we search for all files beginning with Myfile in /home/lubby ignoring the case:

find /home/lubby -iname Myfile*

Here we search for all files in /home/lubby starting with M or m followed by yfile and whatever follows:

find /home/lubby -name '[M|m]yfile*'

Here we search for all occurences of wim in a link (case sensitive)

find /home/lubby -name '*wim*' -type l

This will find all the files 1 day old.

find . -iname wim* -mtime -1

This will find normal files that are smaller than 50 bytes

find /home/lubby -type f -size -50c

This will find normal files that are bigger than 1000k or 1 Megabyte.

find /home/lubby -type f -size +1000k

This will find all normal files that are bigger than 10 MB and execute an la -lah command on it. So it shows all the files and how big they are.

find /home/wpeeters -type f -size +10000k -exec ls -lah '{}' ';'

This command will do exactly the same as the previous one.

find /home/wpeeters -type f -size +10000k -exec ls -lah '{}' \;

About the Author

Wim Peeters is electronics engineer with an additional master in IT and over 30 years of experience, including time spent in support, development, consulting, training and database administration. Wim has worked with SQL Server since version 6.5. He has developed in C/C++, Java and C# on Windows and Linux. He writes knowledge base articles to solve IT problems and publishes them on the Lubby Knowledge Platform.


The information provided in this document is intended for your information only. Lubby makes no claims to the validity of this information. Use of this information is at own risk!