Quite frequently, I reach for a combo of find and cd. Here is how to do it using a single command.

Let’s create a bunch of nested directories, just for the sake of the exercise:

mkdir -p x/y/z

Result:

tree x
x
└── y
 └── z

Suppose I want to locate the y directory and cd to it:

cd "$(find x -name y)"

Similarly, I might want to locate a text file and open it in my favourite editor:

cd ~
touch x/y/z/test.txt
vi "$(find x -name test.txt)"
Categories: Tips & Tricks

Tomas Zezula

Hello! I'm a technology enthusiast with a knack for solving problems and a passion for making complex concepts accessible. My journey spans across software development, project management, and technical writing. I specialise in transforming rough sketches of ideas to fully launched products, all the while breaking down complex processes into understandable language. I believe a well-designed software development process is key to driving business growth. My focus as a leader and technical writer aims to bridge the tech-business divide, ensuring that intricate concepts are available and understandable to all. As a consultant, I'm eager to bring my versatile skills and extensive experience to help businesses navigate their software integration needs. Whether you're seeking bespoke software solutions, well-coordinated product launches, or easily digestible tech content, I'm here to make it happen. Ready to turn your vision into reality? Let's connect and explore the possibilities together.