How to use Find command to search files based on File Size, File Type ?

Use below command for finding some files and searching text into those files, replace DIR_TO_SEARCH with the proper path of directory you want to search in,

Linux command for find and grep

 $ find DIR_TO_SEARCH -name '*.c' -exec grep -i 'main' {} \; -print 

This command, finds all c files in DIR_TO_SEARCH directory and greps text “main” into those c files and prints the path of file on console.

Linux command to find file more that certain specified size

 $ find DIR_TO_SEARCH -size +100M 

This command, finds all files in DIR_TO_SEARCH directory which are more than 100MB and prints the path of file on console.

Linux command to find and remove certain files

 $ find DIR_TO_SEARCH -type f -name FILE_TO_DELETE -exec rm -f {} \; 

Linux command to find a file with name

 $ find DIR_TO_SEARCH -name hellowordld.pdf 

This command will find a pdf file with name ellowordld.pdf you need to use your filename.

Windows search text in files and fo... x
Windows search text in files and folders with Notepad++

Leave a Comment

Sign up to our newsletter!

ADB Commands Android Android Applications Android Build system Application Libraries Application Stack / User Interface Bash / Shell Scripts Bluetooth driver Cloud Technologies Commands and Packages Compilation Content Management System Core Kernel C Programs Development, Debugging and Performance Tools Development and Build Development Environment Setup Django & REST Api Errors & Failures Git Hardware Platforms HTML JAVA Programs Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL Multimedia NDK / Middleware / HAL Operating System Concepts PHP Programming Languages Scripting and Automation Search Engine Optimisation ( SEO ) Social Media Source Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized Web Design and Development Website Hosting Wordpress Yocto Embedded Linux