It seems that in Ubuntu the entries in ~/.ssh/known_hosts are hashed, so SSH completion cannot read them. This is a feature, not a bug. Even by adding HashKnownHosts no to ~/.ssh/config and /etc/ssh/ssh_config I was unable to prevent the host hashing.
However, the hosts that I am interested in are also found in ~/.ssh/config. Here is a script ...
Readline library has bell-style variable:
Controls what happens when Readline wants to ring the terminal bell.
If set to ‘none’, Readline never rings the bell. If set to ‘visible’,
Readline uses a visible bell if one is available. If set to ‘audible’
(the default), Readline attempts to ring the terminal’s bell.
So you can put into your ~/.inputrc ...
This is actually a readline feature called menu-complete . You can bind it to tab (replacing the default complete) by running:
You probably want to add that to your ~/.bashrc. Alternatively, you could configure it for all readline completions (not just bash) in ~/.inputrc.
You may also find bind -p (show current bindings, note that ...
It depends on which popup menu state you are in (see :help popupmenu-completion). I understand from your question that you're in state 2 (since you've pressed arrow keys to find a completion). However, the default behavior for Enter in state 2 is to insert the completion without newline; what you describe is normally the behavior of state 1 (which is when ...
Try complete-alias, which solves this problem exactly.
After install it you can use one generic function to complete many aliases like this:
complete -F _complete_alias <myalias1>
complete -F _complete_alias <myalias2>
complete -F _complete_alias <myalias3>
You may want to source the complete_alias file in every bash instance through ....
First of all, hitting tab in bash is even better since it autocompletes all executables in your PATH irrespecitve of whether they're in the history. That said, there are various ways of getting a command from your history:
Use its number. If you know that the command you want was 3 commands ago, you can just run
That will re-execute the command you ...
I don't know about fixing — there are all kinds of things that could go cause delays. But I can offer a few tips to investigate.
Just as a guess, maybe there's a directory somewhere in a search path ($PATH, or some place where bash looks for completion data) that's on a filesystem which is slow to respond. Usually it's remote filesystems that are slow, but ...
You could make use of the builtin compgen:
compgen: compgen [-abcdefgjksuv] [-o option] [-A action] [-G globpat]
[-W wordlist] [-F function] [-C command] [-X filterpat] [-P prefix]
[-S suffix] [word]
Display possible completions depending on the options.
Intended to be used from within a shell function generating possible
completions. If ...
It does this using bash v4's completion features. The completion code for apt-get is provided by the bash-completion package and located at /usr/share/bash-completion/completions/apt-get. Applications that have completion and are not part of the base bash-completion package place their completion scripts in /etc/bash_completion.d.
The completions are loaded ...
Make sure that you've turned on the fancy autocompletion. On many distributions, this means your ~/.bashrc needs to contain . /etc/bash_completion.
You'll need to have passwordless authentication set up, i.e. with a key that's already loaded in ssh-agent.
Establishing an SSH connection is slow, so you can considerably speed up completions by establishing a ...
At the first time, zsh Completion System seems to be very complex and difficult to grasp. Let try an example.
First thing you need to know, zsh completion system will load completion functions from $fpath. Make sure your completions directory appear in:
print -rl -- $fpath
(If you used oh-my-zsh, there's .oh-my-zsh/completions existed in $fpath, you can ...
The reason that installing command-not-found did not start providing suggestions for non-installed packages was that I had missed a small notification from dpkg as part of the install.
One is supposed to run the command update-command-not-found immediately after running apt-get install command-not-found. In fact dpkg prompts for running this command.
With readline 6.3 and later you can add
set colored-stats on
If set to `on', Readline displays possible completions using different colors to indicate their file type. The color definitions are taken from the value of the LS_COLORS environment variable. ...
I don't have an OSX system handy to check on but on all *nixes, ~foo is a shorthand for the home directory of user foo. For example, this command will move into my user's $HOME (cd ~ alone will move into your home directory):
So, ~ and Tab will expand to all possible user names. The list should be the same as the list of users in /etc/passwd.
compgen -c # will list all the commands you could run.
compgen -a # will list all the aliases you could run.
compgen -b # will list all the built-ins you could run.
compgen -k # will list all the keywords you could run.
compgen -A function # will list all the functions you could run.
compgen -A function -abck # will list all the above in one go.
If your *nix box is setup as an LDAP client you may have this problem, even logged in as a local user.
Boring debug info: Debugging with set-x, I found the completion that was hanging at:
> set -x
> ls foo<tab>
... <--- lots of output removed
+ _quote_readline_by_ref foo quoted
+ '[' -z foo ']'
+ [[ foo == \'* ]] ...
Debian does not come with 'bash-completion' installed and enabled.
To fix this, run (as root):
apt-get install bash-completion
Then, you have two options. You can either (1) enable it on a per-user basis for yourself, or (2) enable it globally.
If you want to enable it for just your user, edit ~/.bashrc - add the following:
if [ -f /etc/bash_completion ]...
You don't say what distro you're using but on my Fedora 19 system I have the following package installed, bash-completion which provides this feature through this completion rule file:
Here's the package I have installed:
$ rpm -aq |grep completion
If you look ...
Oooh, I found an explanation.
To quote the relevant part:
The zsh shell comes with (more than one) great feature(s), such as remote tabcompletion. If you for example want to copy a file over scp, simply hit tab at any part of the filename on the remote host. zsh is able to establish an ssh session on the background, and fetch the related information ...
COMPREPLY=( $(compgen -W "$(ls /something/)" -- $cur) )
complete -F _codeComplete hi
You need to specify the -W option in compgen and also quote the command which produces the wordlist.
More information on how to write completion functions on this blog: Writing your own Bash Completion ...