2

This is probably a stupid question, but I don't seem to understand bash-it and their completions.

I just enabled ssh completion and restarted my terminal. But I can't figure out what it did.

To be real honest with you, I thought something would come up when I tabbed after "ssh". I read their README twice, and they don't explain anything about completions (probably because there is nothing to explain). But I want to learn and as I said - I don't know what it did.

I tried to read the .bash file. All I can figure out is that it does something with hosts...

Long story short: What does all these completions do and how do I use them?

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
gel
  • 307

1 Answers1

3

If you mean Bash completion, it is a mechanism to take care of completion of commands, IF those commands had implemented the support for such. To be more precise, take a look inside /etc/bash_completion.d/.

Inside this folder can be placed an specific script for each command/program which completion has some support.
Looking for ssh inside the repo pointed by you, at https://github.com/Bash-it/bash-it/tree/master/completion/available, you have to copy the ssh.completion.bash to your /etc/bash_completion.d/ folder as root. Adjust the file permission accordingly (I use 644), and make sure that you have installed in you box completion module.

After that, you may be able to utilize, as in the example completion to ssh command.

It's easy to create personalized completion support of your interest. As example, I created a completion for a command to look in specific folders,, which correspond to modules in development. There are several tutorials around. take a look in this one: https://debian-administration.org/article/316/An_introduction_to_bash_completion_part_1

Thomas
  • 6,362