Command line
You can pipe the locate database output and use dirname to print only the directory names.
Here an example:
locate -w -0 . | xargs -0 -P 0 dirname | uniq
The argument -P 0 runs as many processes as possible at the same time which speeds up the task. The last command uniq omits duplicated directories and should be preferred over sort in that case.
To use it as on your need pipe the directories e.g. with grep
locate -w0 . | xargs -0 -P 0 dirname | uniq | grep -i dropknot
Maybe you will like to create an alias like:
alias getdir="locate -w0 . | xargs -0 -P 0 dirname | uniq | grep -i"
Now type this command to search for directories containing foo, Foo, anotherFOOisthis ...
getdir foo # ignore case
getdir \/foo$ # will search for a directory foo at the end and again ignore case
getdir \/foo\/ # search for foo in a subdirectory
Recommended
You can also write a function, which is a better approach. Paste this in your shell configuration e.g. .bashrc or .zshrc
finddir () {
if [ ! "$#" -gt 0 ]; then
echo "Need a string as search pattern\!\ne.g.: finddir foo";
return 1;
fi
locate -w -0 "$1" | xargs -0 -P 0 dirname | grep -i "$1" | uniq
}
Note that you have to filter twice to avoid that a filename which matches the search pattern gets printed. This function is very fast (hyperfast), on my personal machine for instance it takes only 4ms to find all 1004 directories on a 2TB disk matching the x11 pattern.
Use this function the following way:
finddir dropknot
Using fzf
If you are using fzf and zsh you can use a keybind to search on your machine, e.g. put this again in your .zshrc :
# use locate to find and change into that directory
fzf-cd-locate () {
local dir
locate -0 -w . | xargs -0 -P 0 dirname -z | uniq -z |
fzf --read0 --print0 -i | IFS= read -rd '' dir &&
cd -- $dir &&
zle -I
}
zle -N fzf-cd-locate
bindkey '^[l' fzf-cd-locate # creating a shortcut <Alt>+<L>
This looks on my alacritty/tmux terminals as below:

But don't forget that locate uses a database and therefore has to be updated (default is once per day in a cron job if I remember right - it can be set in the configs). The command to use is sudo updatedb. Newer files will be ignored. However it is a super fast method! Further
Locate (mlocate) uses a fr-code (front-compression) and I don't know if there exists a tool for a faster database path's search. You can find more on man locatedb.5.
For the best (fastest) locate use plocate (RedHat's default locate machine), which is the fastest of them all. Install it on debian with sudo apt install plocate and make sure it is the selected locate alternative with sudo update-alternatives --config locate.