vifm terminal window
vifm and vicd
fasd terminal window
fasd

cd

For years, when using the terminal shell I’ve used the “cd” command to change to a different directory.

cd  ~/Documents/projects/python_projects/my_project

cd is a standard command in macOS, Linux and Windows terminal, no need to install a package.

cd simple shortcuts

cd -

Changes to previous directory. Can be used repeatedly to toggle between two directories.

cd < drag folder >

On macOS you can type “cd “ and then drag a directory folder from the Finder into the terminal to type the path.

faster ways to change directory

Recently I’ve been using the shell more often, and changing between more directories. Even with tab-completion, it is cumbersome to type “cd “ and then a long directory path. So I started looking for more efficient ways to change the current directory. Here are several alternatives:

pushd

pushd changes directory similar to cd, but it also pushes the directory onto a navigation stack. Then you can use the stack to change to any previous directory. pushd is a standard command in macOS and Linux, no need to install a package.

How to change directory quickly with pushd

vifm and vicd

vifm is a file manager, and can be customized by adding a function like vicd to change directory easily. vifm is similar to ranger, but supports vim-like keybindings.

How to change directory quickly with vifm

fasd

fasd automatically builds a list of directories and files, sorted by “frecency” (frequency and recency). You can set a command “z” and type z < directory path last component > to change directory.

How to change directory quickly with fasd