ssh中将常用的命令做别名
1.vim ~/.bashrc
将光标落到user下面
2. 输入 alias x=‘ssh的命令’
3.按ESC键,退出输入状态;
4.按:,然后输入wq,保存退出;
5. source ~/.bashrc 更新下该文件
2016.10.25update:
add jmeter alias!
alias jmeter='open /usr/local/Cellar/jmeter/3.0/bin/jmeter'
---------------
**2020.01.19 update:**
####add git alias
1. vim ~/.gitconfig 进入gitconfig配置文件
2. 设置快捷方式如下:
```
[alias]
history = "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
```
3. 效果: git history
whhhhh 奏是这么花里胡哨
-----------------------------
补一个 ssh 连接的东东
terminal 总是中断
于是 在 本机terminal设置:
`~/.ssh/config
`
添加:
TCPKeepAlive=yes
# Client每隔 60 秒发送一次请求给 Server,然后 Server响应,从而保持连接
ServerAliveInterval 60
# Client发出请求后,服务器端没有响应得次数达到3,就自动断开连接,正常情况下,Server 不会不响应
ServerAliveCountMax 3
然后不放心,又在 ssh 的目标ip上添加:
sudo vi /etc/ssh/sshd_config
# Server 每隔 60 秒发送一次请求给 Client,然后 Client响应,从而保持连接
ClientAliveInterval 60
# Server发出请求后,客户端没有响应得次数达到 10,就自动断开连接,正常情况下,Client不会不响应
ClientAliveCountMax 10
sudo restart ssh
希望有用吧
hhhhh 来事儿啦
连不上,报了个错,但是连另外一台ip就可以 it works fine,same os, same version。
然后把昨天加的 三行去掉,可以了。。但是不知道这个ssh 能保持多久。
ClientAliveInterval 60
ClientAliveCountMax 10
sudo restart ssh
1 | kex_exchange_identification: read : Connection reset by peer |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ~ 🔥» ssh -l root 10.219.57.250 vivi@vivideMacBook-Pro kex_exchange_identification: read : Connection reset by peer 🔥------------------------------------------------------------ ~ 🔥» ssh -l root 10.219.57.250 -vv vivi@vivideMacBook-Pro OpenSSH_8.1p1, LibreSSL 2.7.3 debug1: Reading configuration data /Users/vivi/ . ssh /config debug1: /Users/vivi/ . ssh /config line 5: Applying options for * debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 47: Applying options for * debug2: resolve_canonicalize: hostname 10.219.57.250 is address debug2: ssh_connect_direct debug1: Connecting to 10.219.57.250 [10.219.57.250] port 22. debug1: Connection established. debug1: identity file /Users/vivi/ . ssh /id_rsa type 0 debug1: identity file /Users/vivi/ . ssh /id_rsa-cert type -1 debug1: identity file /Users/vivi/ . ssh /id_dsa type -1 debug1: identity file /Users/vivi/ . ssh /id_dsa-cert type -1 debug1: identity file /Users/vivi/ . ssh /id_ecdsa type -1 debug1: identity file /Users/vivi/ . ssh /id_ecdsa-cert type -1 debug1: identity file /Users/vivi/ . ssh /id_ed25519 type -1 debug1: identity file /Users/vivi/ . ssh /id_ed25519-cert type -1 debug1: identity file /Users/vivi/ . ssh /id_xmss type -1 debug1: identity file /Users/vivi/ . ssh /id_xmss-cert type -1 debug1: Local version string SSH-2.0-OpenSSH_8.1 kex_exchange_identification: read : Connection reset by peer |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧