unixsshscpitermproductivity-power-tools

How to stop retyping "ssh user@domain.com" over and over


My workflow always consists of opening a new terminal window, typing ssh user@domain.com (or scp) followed by cd remote/directory/of/project

The domain is long and hard to type, as well as it being a big file path so this takes me ~20 seconds every time. What's the canonical, efficient way to do this that you would see a senior dev doing?


Solution

  • For not retyping ssh user@domain.com that often, you can put it in you .ssh/config:

    Host my_alias
    HostName domain.com
    User user
    

    Afterwards, you can just type ssh my_alias.

    For not retyping the path, you can

    You may also google these pointers for more details (like how to save tmux session and further details in your .ssh/config)