'cd' command in terminal - using partial folder name

If you know that the name is unique after a few typed letters, you can do – for example to go to the folder "FooBarBaz":

cd Foo*

The * glob will expand to the name of all folders starting with Foo, and cd will go to the first folder found.

The same works the other way around, or if the part you know is in the middle of the folder name:

cd *Baz
cd *Bar*

This probably requires the least keypresses. You can just press Enter and it'll expand automatically.

You can get even shorter if you set the autocd option, assuming you use Bash, with shopt -s autocd. It requires you only to type the directory name without cd to have the shell cd to it. For example:

shopt -s autocd
Foo*

Of course, you can add this option to your shell's configuration file to have it loaded automatically (e.g., ~/.bash_profile or ~/.bashrc, depending on what you use).


You can use the Tab ↹ key to auto-complete partially typed filenames.


You can try use zsh, it has advanced command completion features

cd /u/sh/lo + tab = cd /usr/share/locale

Also we can use zsh hash aliases and other magic zsh functions)

https://github.com/robbyrussell/oh-my-zsh https://github.com/zsh-users/zsh-completions