Find is very good at, well, finding files. But it is vastly more useful when combined with other commands. Suppose you wanted to delete all Gif files you had across multiple directories.
cd /some/path
find . -name '*.gif' -exec rm -f {} \;
Or combine find with grep to search inside all or specific files.
find . -exec grep -Hn monkey {} \;
find . -name '*.txt' -exec grep -Hn monkey {} \;
The former searches all files recursively (from the current working directory) and the latter only searches files ending in .txt.
0 comments:
Post a Comment