Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I want to navigate inside folder with long hard-to-type name, is there way to use 'cd' with some kind of shortened name of this folder, to get free from unnecessary work?

share|improve this question
up vote 8 down vote accepted

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

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).

share|improve this answer
nnnnniiiicccee! – Gill Bates Mar 2 '13 at 19:11

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

share|improve this answer
Upvoted in 3 seconds. :D – grawity Feb 28 '13 at 21:47
Must've been the fastest upvote I've seen. – slhck Feb 28 '13 at 21:47

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)

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .