10 Useful Find Command for Linux Users

terminal1Computers are about storing and retrieving information, and how fast you can find and process that information makes all the difference in the world, not to mention that makes your job a lot easier. Here are 10 find commands that I find very useful.

1- searching for a file starting at current directory, and ignoring case

find . -type f -iname filename
ind . -iname filename

2- search for a directory ignoring case sencitive

find . -type d -iname directoryName

3- finding especific files and moving them to another directory

find . -name '*.mp4' -exec mv '{}' ~/movies ;

4- changing permision to multiple files at once

find . -type f -exec chmod 0777 '{}' ;

5- find files bigger than 1g in size

find . -size +1g

6- find files older than 5 days and newer than 10. Using -a as a logical “AND”

find . -type f -mtime +5 -a -mtime -10 #using -a as logical and

7- find a especific file with especific content

find . -name '*.txt' -exec grep -ih comedy

8- find all files that have read permision to group

find . -perm -g=r -type f -exec ls -1 {} ;

9- find files newer than a given file

find . -newer filename

10- find and backup files and directory that are newer or have changed in last 30 days

find . -name f -mtime -30 -exec tar -cvzf test.tar.gz '{}' \;
Share This!
One Comment

Add a Comment

Your email address will not be published.

Sign up for our Newsletter

Download "Google Search Pro"

Enter your email and stay on top of things,