Ubuntu – How to recursively search for directory names with a particular string where the string is only part of the directory name

grep

How can I recursively search for directory names with a particular string where the string is only part of the directory name?

For example:
the directory name is "8.0.3-99966_en", but I want to recursively search for directories with the string "99966".

Best Answer

You can use the find command:

find YOUR_STARTING_DIRECTORY -type d -name "*99966*" -print

Example:

find ~ -type d -name "*99966*" -print

should find all directories (-type d) starting from your home directory (~)that have their names containing the string "99966" (-name "*99966*") and output them (-print).