SSH - Autosuggestions with ZSH
Get instant SSH autosuggestions in ZSH. Learn to install the zsh-ssh-config-suggestions plugin and display all your ~/.ssh/config aliases with a simple TAB press.
This article is part of the SSH - From your first key to remote development series:
- GitHub - Connect your account using SSH and start to work with git@ protocol
- Docker secrets - Using your SSH key during the build process
- Using sftp on the command line, with or without a proxy
- SSH - Autosuggestions with ZSH
- SSH - Launch a terminal on your session without having to authenticate yourself
- How to connect to your hosting server using SSH
- SSH Remote development with VSCode
- Open a DevContainer on a Remote Server with VSCode Remote SSH and ProxyJump
- SSH Config Generator: Wildcard Stanzas, Aliases, and Automated Logins
Changelog

Stop memorizing server IPs and SSH commands. This article shows you how to streamline your SSH workflow with zsh-ssh-config-suggestions, a ZSH plugin that provides autosuggestions for your SSH connections. By leveraging your ~/.ssh/config file, this plugin allows you to simply type ssh and press Tab to see a list of all your configured server aliases. Learn how to install and configure this handy plugin to make connecting to your servers faster and more efficient.
A few weeks ago, I've posted a SSH - Launch a terminal on your session without having to authenticate yourself article about the ssh command in Linux.
I'm pretty sure, like me, you are tired of typing command lines like ssh christophe@1.2.3.4 to start an SSH connection because ... you know, you don't need to connect on a server; no, you need to connect to the server where the application is running; you know the name of the MyAmazingApp application but certainly not the name of the server or its IP.
That's the case for me anyway.
So, I need to connect to my vault, in which I list all the information about applications, server names, credentials to be used, ...
It would be pretty cool to run ssh MyAmazingApp no?
Two neighbours: How to connect to your hosting server using SSH to fill that ~/.ssh/config in the first place, and Master your ssh command and select the host from a list when autocompletion is no longer enough — around fifty hosts, a searchable list beats TAB.
Here's the result: type ssh (with the trailing space) and press TAB to get every alias from your ~/.ssh/config file, autosuggested.

You should add a space character after `ssh`
To make it working, please note: you should add a space character after having typed ssh and before pressing tab.
Why It Works
The plugin reads the Host aliases already declared in your ~/.ssh/config file and wires them into ZSH's completion system — no separate list to maintain, no vault to open, just the config file you already have.
It should be really nice to be able to run ssh MyAmazingApp and hop, I'm connected on the server.
This is where the ~/.ssh/config is so helpful (please refer to this article) but we can go one step further: it would be so great to type ssh and by some magic, Linux will show you the list of aliases defined in the ~/.ssh/config file. Let's install it.
Seeing It in Action with Docker
No real server is ever contacted by this plugin — it only reads Host aliases from a config
file — which makes it a perfectly safe one-command Docker test.
Why Docker first?
The Dockerfile below installs Oh-My-Zsh and the plugin, enables it in ~/.zshrc, and writes the
exact ~/.ssh/config shown further down. Nothing on your own machine changes, and nothing tries
to actually connect anywhere.
Build and run it:
$ docker build -t ssh-suggest-demo . [+] Building 20.7s (8/8) FINISHED ✔ exporting to image
$ docker run --rm -it ssh-suggest-demo 🐳 root ~ # ssh
Type ssh (with the trailing space) and press TAB — the same four aliases from the
"Use it" section below (MyAmazingApp_PROD, MyAmazingApp_TEST, YourAmazingApp,
LegacyApp) show up immediately, read straight from the pre-baked ~/.ssh/config.
Installation of the zsh-ssh-config-suggestions plugin
This assumes Oh-My-Zsh is already installed (see How to install Oh-My-ZSH if not). Just clone the official repository by running this command: git clone https://github.com/yngc0der/zsh-ssh-config-suggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-ssh-config-suggestions. You'll get a local copy of the plugin in your Oh-my-zsh plugin folder.
Then edit the ~/.zshrc file, search for plugins=( and add zsh-ssh-config-suggestions to the list. You'll have f.i. something like:
plugins=( git # ... your existing plugins zsh-ssh-config-suggestions)This is a zsh shell configuration snippet that defines a list of plugins to load. It shows how to add the 'zsh-ssh-config-suggestions' plugin to your existing plugin list, alongside the built-in 'git' plugin.
Close your console, open a new one (or run source ~/.zshrc to load your change) and it's done.
Use it
Imagine I've this content in my ~/.ssh/config:
Host MyAmazingApp_PROD Hostname 1.2.3.4 User usr_app_prod
Host MyAmazingApp_TEST Hostname 6.7.8.9 User usr_app_test
Host YourAmazingApp Hostname 1.2.3.4 User you
Host LegacyApp Hostname 1.2.3.4 User legacyThis is an SSH configuration file that defines shortcuts for connecting to four different remote servers. Each Host block gives a nickname (like MyAmazingApp_PROD) along with the actual server IP address and username needed to log in, so you can type 'ssh MyAmazingApp_PROD' instead of 'ssh usr_app_prod@1.2.3.4'.
Now, I really don't need to remember anything and I don't even need to know the names of the aliases any more!
I just need to type (it's important): ssh followed by TAB and I get the same suggestions already shown at the top of this article.
As you can see, the system will display the list of hosts defined in my configuration file! I can then edit the file, add a new application and hop, next time, I'll get its name in the list. I don't need to connect to my vault anymore. Nice no?
This is just one plugin among many; if your ~/.zshrc is starting to grow with this kind of customization, have a look at Beyond the Monolith - Organizing Your ZSH Workflow Like a Pro to keep it maintainable.
This article is part of the SSH - From your first key to remote development series:
- GitHub - Connect your account using SSH and start to work with git@ protocol
- Docker secrets - Using your SSH key during the build process
- Using sftp on the command line, with or without a proxy
- SSH - Autosuggestions with ZSH
- SSH - Launch a terminal on your session without having to authenticate yourself
- How to connect to your hosting server using SSH
- SSH Remote development with VSCode
- Open a DevContainer on a Remote Server with VSCode Remote SSH and ProxyJump
- SSH Config Generator: Wildcard Stanzas, Aliases, and Automated Logins
Loading comments…




