GTKC Knowledgebase
A little bit of wisdom
Performing recursive commands on a Unix / Linux file system.
Posted by  Admin on


Change Unix file permissions recursively:

To list:
Note: use "iname" for a case insensitive operation
find . -name "*.pls" -exec ls -ls {} \;

To Change
find . -name "*.pls" -exec chmod 750 {} \;

(execute the chmod command for every file [named *.pls] found by find.)
find . -type d -exec chmod 755 {} \; (type d for directories)

(execute the chmod command for every directory found by find.)
find . -type f -exec chmod 755 {} \; (type f for files)

(execute the chmod command for every file found by find.)

More:

To list
find . -name "*.pls" -exec ls -ls {} \;

To Change
find . -name "*.pls" -exec chmod 750 {} \;

(execute the chmod command for every file [named *.pls] found by find.)
find . -type d -exec chmod 755 {} \; (type d for directories)

(execute the chmod command for every directory found by find.)
find . -type f -exec chmod 755 {} \; (type f for files)

(execute the chmod command for every file found by find.)

Search for a directory called transfer, to a maximum of two levels deep,

then calculate the amount of disk space used therein.
find . -name "*ansfer" -type d -maxdepth 2 -exec du -ms {} \;


Tags: Filesystem , Linux

Return to home page: Home