DEV Community

Cover image for Stop Typing ssh user@ip
Tobrun Van Nuland
Tobrun Van Nuland

Posted on

Stop Typing ssh user@ip

I'n facepalming that I'm only learning this now but my whole life I've been connecting to other computers with:

ssh admin@192.168.1.2
Enter fullscreen mode Exit fullscreen mode

Over. And over. And over again.

If that’s you also: no judgment, but we can do better.

This is one of those once you know it, you can’t unsee it.


The right solution: ~/.ssh/config

Instead of aliases, scripts, or shell hacks, let SSH itself do the work.

Create (or edit) your SSH config:

code ~/.ssh/config
Enter fullscreen mode Exit fullscreen mode

Add this:

Host server
    HostName 192.168.1.2
    User admin
Enter fullscreen mode Exit fullscreen mode

From now on:

ssh server
Enter fullscreen mode Exit fullscreen mode

That’s it.

No usernames. No IPs. No mental overhead.


Bonus: auto‑attach tmux on login

If you live in tmux (and if you don’t… you probably will), this is gold:

Host server
    HostName 192.168.1.2
    User admin
    RequestTTY yes
    RemoteCommand tmux attach || tmux new
Enter fullscreen mode Exit fullscreen mode

This instantly drops you into your session. Disconnect your computer, reconnect later — state intact.

This is especially nice for long‑running agents or builds.

Top comments (0)