The smart find and grep utilities

search_compfind and grep are most useful friends when you are connected to an unfamiliar remote Linux box via a terminal or trying to find some specific files or a particular string in any file.
For example, to find all movies matching the name “evening”, of type MKV and size between 650MB to 750MB in the current directory recursively, you can run:

# find . -iname '*evening*.mkv' -size +650M -size -750M

To find the c files accessed and modified in the last 10 minutes:

$ find /home/david -amin -10 -name '*.c'
$ find /home/david -mmin -10 -name '*.c'

Look for string in .c and .cpp files:

$ grep -nr string --include=*.c --include=*.cpp

Check out the man pages for many more useful options.

One thought on “The smart find and grep utilities”

Leave a Reply

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