Thursday, April 23, 2009

Powerful Unix find command

List the files contain the word Unix in the current tree:

find . -type f -exec grep -l Unix {} \;

Set permission to 644 for all files in the current tree:

find . -type f -exec chmod 644 {} \;

The number of files in the current tree:

find . -type f -exec ls -l {} \; | wc -l

All the text type files in the current tree:

find . -type f -exec file {} \; | grep text

No comments: