如何停止“ ssh user@domain.com"一遍又一遍地
我的工作流程始终包括打开一个新的终端窗口,输入 ssh [email protected]
(或scp
),然后是cd remote/directory/of/project
该域名很长且难以键入,而且它是一个很大的文件路径,因此每次大约需要 20 秒。您会看到高级开发人员采用的规范、有效的方法是什么?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用要执行的命令创建一个脚本文件,这样您就可以直接执行它,而不必每次都手动键入 ssh/scp/cd 命令。
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.
对于不重新输入
ssh [email protected]
通常,您可以将其放入.ssh/config
中:之后,您只需输入 ssh
my_alias
即可。为了不重新输入路径,您可以
.bashrc
中的别名中(alias cd_my_proj='cd remote/directory/of/project'
)ln -s remote/directory/of/project ~
)您也可以谷歌这些指针以获取更多详细信息(例如如何保存 tmux 会话以及 .ssh/config 中的更多详细信息)
For not retyping
ssh [email protected]
that often, you can put it in you.ssh/config
:Afterwards, you can just type ssh
my_alias
.For not retyping the path, you can
.bashrc
(alias cd_my_proj='cd remote/directory/of/project'
)ln -s remote/directory/of/project ~
)You may also google these pointers for more details (like how to save tmux session and further details in your .ssh/config)