4

I've just started using mosh and I'm left thinking to myself "why didn't I start using this like two years ago?"

I'm even more impressed by the fact that it reads my ~/.ssh/config and respects the aliases in it. The only thing I'd like now is for tab completion on the aliases, like ssh does. Is there a way?

4
  • 1
    Do you mean completion of aliases on the command line of ssh or mosh, i.e. when you type mosh myni<TAB> and it completes to mosh mynickname? That's done by your shell, probably bash, zsh or fish. What shell are you using? May 28, 2017 at 22:32
  • 1
    Why didn't you use it 6 years ago? gist.github.com/aliang/1024466 May 28, 2017 at 23:06
  • Because I was probably running a pirate copy of Windows 7 at the time (shudder). :0)
    – bitofagoob
    May 29, 2017 at 1:03
  • @Gilles I'm using bash. I'm gonna try either an alias or setting something in my hosts file.
    – bitofagoob
    May 29, 2017 at 1:18

2 Answers 2

2

zsh has great autocomplete functionality. Install zsh and make sure completion is setup (instructions here). The parts related to ssh you want in your .zshrc:

zstyle ':completion:*:ssh:*' hosts
compdef mosh=ssh

The first line will allow you to use allow tab completion of host names in response to ssh. The second line extend the same hostname extensions to mosh as well

0
0

I've added some .bash_aliases to log into my various systems:

alias mj='mosh j3710'
alias m3='mosh 3770k'
etc.
etc.

I tried adding them to /etc/hosts but it didn't work. I'm sure there's probably a neater way of doing it but if nothing is suggested within the next couple of days I'll mark this as answered.

You must log in to answer this question.

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