Changing directories faster with fzf, find and cd
You can also read the story for free here.
Have you ever had this problem when you had to change directories but didn’t want go there by using cd <relative-path>
. We can somehow use pushd and popd. But it's not going to solve the problem. You still need to push the directory. What if you just write the directory name and press enter and voila you're there. No matter how many levels deep your directory is, it's still going to find it.
When working in the terminal, we often find ourselves needing to navigate to specific directories quickly. However, traditional methods like manually typing out directory paths or using the cd command with tab completion can be time-consuming and error-prone, especially in complex directory structures. Additionally, tools like find lack interactivity, making it difficult to search and select directories efficiently.
We can use fd and fzf to streamline directory navigation. fd is a blazing-fast alternative to find that efficiently searches directories, while fzf provides an interactive fuzzy search interface. By combining these two tools, we can quickly locate and navigate to directories with ease.
The key to our solution lies in creating a custom function that integrates fd and fzf for directory navigation.