0

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?

Stuart Rucker
  • 189
  • 3
  • 7
  • Put it in a script file you run when opening your new terminal window. – Martin Apr 05 '22 at 14:20
  • 1
    put `user@domain.com` in your .ssh/config with a convenient alias. For the path your could search your command history (Ctrl+R), use an alias (in your .bashrc) or us a soft link `ln -s remote/directory/of/project ~` – LinFelix Apr 05 '22 at 15:03

2 Answers2

2

You can create a script file with the commands you want to execute so you can just execute it instead of manually typing your ssh/scp/cd commands every time you have to do so.

LinFelix
  • 1,026
  • 1
  • 13
  • 23
Waza-Ari
  • 21
  • 3
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 06 '22 at 00:09
2

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

  • put the path in an alias in your .bashrc (alias cd_my_proj='cd remote/directory/of/project')
  • look it up in your bash history (usually with Ctrl+R)
  • use a soft link (ln -s remote/directory/of/project ~)
  • keep the path open in a tmux (or screen) session

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

LinFelix
  • 1,026
  • 1
  • 13
  • 23