Linux / Unix / OS X CLI Recipes

List files only, or directories only

To get a list of files only, or directories only, use the -type parameter of the find command:

find . -type f

Chmod files based on type

Use chmod to change the permissions of files or directories only by operating on the output of find. For example:

chmod 644 `find . -type f`
chmod 755 `find . -type d`