Total Pageviews

Thursday, April 12, 2012

Find command Usage

find files with name -->
find / -name Chapter1 -type f
find /usr /home -name Chapter1 -type f
find /usr -name "Chapter*" -type f
find directory -->
find . -type d -name build
all files that end with the extension .java, and contain findString -->
find . -type f -name "*.java" -exec grep -l findString {} \;
use the -i argument to the grep command, telling it to ignore the case of search  string -->
find . -type f -name "*.java" -exec grep -il string {} \;
Acting on files that are found : files are found, their permission is changed to mode 644 -->
find /usr/local -name "*.html" -type f -exec chmod 644 {} \;
Print with file last modification time,size etc -->
find . -name "*.pl" -exec ls -ld {} \;
Case-insensitive file searching -->
find . -iname foo
Depth and size usage -->
find -L . -maxdepth 2 -type f -size 0

No comments:

Post a Comment