find
search for files in a directory hierarchy
- Find the file named ls recursively in /bin.
find /bin -name ls
- Find files or directories in the directory /root owned by the user root.
find /root -user root
- Recursively find all JPGs in the /home directory and copy them to the current working directory.
find /home -type f -name *.jpg -exec cp {} . \;- Recursively find all PHP files in the current working directory and determine which of the files contain calls to the PHP mysql_connect function.
find . -type f -name '*.php' | xargs grep 'mysql_connect('- Find the number of lines for given extensions. This example would give you the number of lines for all Python and C++ files in the current directory and below.
find . -regextype posix-egrep -regex '.*(py|cpp)$' | xargs wc -l