search for a directory in linux code example

Example 1: find folder linux

find / -type d -name 'folder_name'

Example 2: linux find directores

find -type d -iname $name

Example 3: find folder in linux

find / -name "dir-name-here"

Example 4: find folder in centos 8

find / -type d -name "apt" 
sudo find / -type d -name "apt"

Example 5: how to search in a directory files in linux

# this will search all subdirectories for text (no case sensitivity)
grep -inR "your text" .
# Node: this command will search for text INSIDE Files, not file names

Example 6: search a folder in linux

$ locate --basename '\pkg'

Tags:

Misc Example