Find a directory by name

For example, find all directories named 'cache'

find -type d -name cache
  • find is the simplest command you can use to find files and folders
  • -type flag means search only of this type, d is for directories
  • -name flag means search for this name, cache is what i searched for

You can take it a step further by using -exec to run some action on the directories you found. For example, i can use the command below to find all directories named cache and set their permissions to 777

find . -type d -name cache -exec chmod 777 {} \;

Please note that this site and the posts on it are, and will always be, a work in progress. If i waited for perfection, i’d never get anything done.