0

I have simple problem that I have to long directories which I want to cd into, but I would like to know easy way.

mosquito@mosquito-K56CB:~/Downloads$ ls | grep Guns
Guns n' Roses - Appetite for Destruction (Japanese Edition) 1987
Guns n' Roses - Use Your Illusion I 1991

Of course I can just copy the name and put it like this: cd "Guns n' Roses - Appetite for Destruction (Japanese Edition) 1987"

But why when I write cd Guns then tab, it finishes line into: cd Guns\ n\'\ Roses\ -\ then by my understanding I should just start writing App.. with tab and it should finish whole name, but it does not. And hitting tab twice does not show me anything either. What I am missing here?

  • I never knew the trick with the tab key - thanks! You might look into being able to open a terminal in a directory from nautilus - this link shows how to enable that function. http://askubuntu.com/questions/207442/how-to-add-open-terminal-here-to-nautilus-context-menu – Charles Green Jun 09 '14 at 15:34
  • @user1880405 I've tested it. It seems character ' has some objections try after removing it. – Pandya Jun 09 '14 at 15:51
  • You are right sir, removing ' fixed the problem, now I will know! – user1880405 Jun 09 '14 at 15:55

1 Answers1

1

EDIT: Actually trying the same directory names in bash, I get the same error. Removing the ' from the directory names makes it work, so I'm guessing that this is a bug in the bash tab-completion.

EDIT 2: According to this question, it's a known bug that will be fixed in a future release.

You could still try zsh as a drop-in replacement and install the Grml zsh config, which really takes you to a whole new level of tab completion:

sudo apt-get install zsh
wget -O ~/.zshrc http://git.grml.org/f/grml-etc-core/etc/zsh/zshrc
wget -O ~/.zshrc.local  http://git.grml.org/f/grml-etc-core/etc/skel/.zshrc
zsh

If you like it and want to use it as your default shell, run chsh -s /usr/bin/zsh.

kraxor
  • 5,527
  • Hitting tab 3 or any amount of times does not do anything. Added your line, didn't change anything. – user1880405 Jun 09 '14 at 15:46
  • Please see my edit, I think bash-completion is just buggy. – kraxor Jun 09 '14 at 15:51
  • I see now, thanks kraxor. But those 2 methods (copying name and 'tabbing') are the only ways to get into multiple word directory? – user1880405 Jun 09 '14 at 15:52
  • You could do something like cd Gun<TAB>*Japan* as a workaround. But if you use the terminal quite often, you should definitely try zsh, once you get there, you never even look back. It's pretty much compatible so you don't have to learn anything new, just enjoy the extra features. – kraxor Jun 09 '14 at 15:58
  • Wow that's a nice trick! Anyways, gonna take a look into zsh as you say. Thank you, case solved. – user1880405 Jun 09 '14 at 16:04