How to Search for Directories in Ubuntu with the Find Command (Quick and Dirty)

If you’ve ever spent ages clicking through folders trying to locate one with a specific name, then you’ve probably cursed how slow the default file explorers are. That’s where the find command shines — it grips the terminal and hunts down your directories recursively, even if it feels like looking for a needle in a haystack. No, it’s not magic, but knowing how to whip this tool into shape makes life way easier—especially when you’re wading through tons of files and don’t want to endlessly click around. Once you get the hang of it, you’ll save a boatload of time.

Step 1: Open the Terminal

First off, if you’re not already in the terminal, it’s time to pop it open. The fastest way is to hit Ctrl + Alt + T. Done. Alternatively, search for “Terminal” in your apps menu — whatever works. This is where all the magic happens, so get comfortable.

Step 2: Basic Command to Find Directories

To get started, here’s a simple command that’s pretty much what you need to remember:

find . -type d -name '*yourword*'

Breaking it down:

  • . means start searching from where you currently are, not the whole system.
  • -type d filters out files, so you’re only hunting for directories.
  • -name '*yourword*' looks for folder names containing “yourword”. Make sure to swap out yourword for whatever you’re hunting down.

For example, if you’re after folders with “log” in their name, type:

find . -type d -name '*log*'

This will ship through all subfolders and give you every match. Kinda neat, right?

Step 3: Recursive Search & Why It Matters

Yeah, the command searches in all subdirectories underneath your current folder automatically. No need for extra arguments. This is why it’s so powerful — it digs deep without extra fuss. This includes hidden folders, unless talking about hidden in the Unix sense (files starting with .). Be aware that on really bloated systems, it might take a second, so don’t freak out if it hangs for a bit.

Step 4: Search the Whole System (But Be Careful)

If you need to find something anywhere in your entire Linux tree, you can tweak it like this:

sudo find / -type d -name '*log*' 2>/dev/null

Here, / is the root, gonna scan everything. Because of permissions, you’ll often get a lot of “Permission denied” errors — that’s normal. Adding 2>/dev/null just mutes those annoying errors so your results stay clean. Keep in mind, running as sudo can sometimes cause other problems, so only do it if you know what you’re doing.

Extra Tips & Troubleshooting

  • Double-check your search string for typos. It’s annoying to run a command, only to realize you missed a letter.
  • If you find you’re getting flooded with “permission denied” messages, adding sudo does help — just don’t do this casually every time.
  • Use -iname instead of -name for case-insensitive searches, e.g., find . -type d -iname '*Log*'. Handy if you’re not sure about the casing.
  • Sometimes, you just want to see the output better. Pipe it through less:
    find . -type d -name '*log*' | less. That way, you can scroll without losing your place.

Conclusion

This whole find thing is a game-changer if you spend time digging through directories. It saves you clicking around and makes organizing or troubleshooting far less painful. Honestly, it’s kind of weird how hidden some folders can be, but with these commands, you’re in control. And yes, it’s pretty satisfying to see that list pop up — feels like you’re hacking something, even if it’s just the command line.

Frequently Asked Questions

Can I find multiple names at once?

Sure, using -o (or) inside parentheses. Example:
find . -type d \( -name '*log*' -o -name '*backup*' \). Just remember to escape parentheses with backslashes if in bash.

What if my search produces way too many results?

Pipe it into less like this:
find . -type d -name '*log*' | less. That way, you can scroll comfortably without losing your place.

Is find available on all Linux distros?

Yeah, pretty much everywhere. It’s a standard utility, so no worries. If you’re on Ubuntu, it’s there by default.