A time-saving way to change directory to sibling directories
Abstract
Introducing the shell variable CDPATH
for more convenience when changing directories using cd
.
How often do you execute cd ..
? If you add ..
to your shell’s environment variable CDPATH
, then you won’t need to write cd ..
so often anymore.
Imagine your ~/.config/
directory contains these subdirectories:
.
├── bash
├── git
├── nvim
└── zsh
You’re inside ~/.config/zsh/
and now would like to change directory to ~/.config/bash/
. You’d probably do cd ..
and then cd bash
, right? Imagine you could omit the cd ..
and do just cd bash
. From within ~/.config/zsh/
! Rather than from ~/.config/
! By setting the variable CDPATH
you can jump directly to siblings without having to visit the parent first.
Read on to find out more.