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
 
kex_exchange_identification: read: Connection reset by peer
~ 🔥» 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

  

 

 

posted @ 2016-10-09 11:34  vivi~  阅读(1301)  评论(7编辑  收藏  举报