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 thought on “10 Useful Find Command for Linux Users

  1. codeguy

    I use #3 all the time, but instead of .mp4, I use .mp3 to play my music files
    find . -name ‘*.mp3’ -exec mplayer ‘{}’ \;

Leave a Reply

Your email address will not be published.