4 ms·
Why would you want "cd folder/<TAB>" instead of "ls folder" ?
by enriquto 5y ago
Why would you want "cd folder/<TAB>" instead of "ls folder" ?
- gmueckl 5y agoIf you are navigating a complex folder structure, it's easy to start typing > cd path/to/ and then realizing that you don't remember whether you need subdirectory1 or subdirectory2 next. With tab completion, you can just continue typing > cd path/to/subdirectory1<tab><tab> to check whether what's in there is what you're looking for. Without tab completion, you need to move to the start of the line, change "cd" to "ls", run that, go back up in the history, change "ls" to "cd" and continue from there. It's much more inconvenient.
- loa_in_ 5y agoThen what you want is the autocd shell option enabled. See info bash
- JNRowe 5y agoYou don't need to choose, fex bash has complete-filename which is bound to M-/ by default¹. You can rely on smart completion for most uses, but should you suddenly desire to complete a filename in an odd place you simply use the direct binding. There are a variety of other completion mechanisms(user, var, etc) with default bindings available too for other out-of-context uses. ¹ zsh users can imitate the same effect with a custom zle function using `completer _files`