iTerm2出现'xterm-new':未知的终端类型,解决方法

在MacOS使用iTerm2,ssh到一个远程实例并尝试运行top命令,显示以下错误: ‘xterm-new’:未知的终端类型。 不仅对于top命令,对于其他命令显示相同的错误,并且命令未按预期执行。

解决方法输入命令:
echo "export TERM=xterm-256color" >> ~/.bashrc
source ~/.bashrc

阅读全文

查看linux端口使用情况

查看指定端口使用情况:

1
netstat -tunlp | grep 端口号

阅读全文

安装第三方jar包到本地maven仓库

有时候我们需要通过maven来远程下载jar包,由于网速或者仓库地址问题导致下载失败或者非常缓慢。这时候我们可以通过下载jar包到本地,然后安装jar到本地仓库,然后再pom.xml中引入就可以直接使用了。

命令如下:

1
mvn install:install-file -Dfile=log4j-1.2.16.jar -DgroupId=log4j -DartifactId=log4j -Dversion=1.2.16 -Dpackaging=jar

阅读全文

REMOTE HOST IDENTIFICATION HAS CHANGED!解决方法

今天在用终端连接服务器的时候,出现了如下的错误提示:

1
2
3
4
5
6
7
8
9
10
11
12
13
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
SHA256:uzs+5cJWmOXGWTKo4X1OPjfweGxky7jU/bDAhI5NEac.
Please contact your system administrator.
Add correct host key in /Users/jarman/.ssh/known_hosts to get rid of this message.
Offending RSA key in /Users/guojingman/.ssh/known_hosts:9
RSA host key for 173.22.112.15 has changed and you have requested strict checking.
Host key verification failed.

阅读全文

MacOS Sierra使用PPTP协议连接VPN

截止目前,最新版的MacOS Sierra已经取消PPTP协议连接VPN,网上找到替代方案,经本人实际配置证实可用,配置如下:

  1. 系统偏好设置 -> 网络 -> “+” 。
  2. 接⼝选择”VPN”,VPN类型选择”IPSec上的L2TP”,填写服务名称(任意)。

阅读全文

git命令行免密码push

对于习惯用git命令行的人来说,每次进行push操作都需要输入用户名和密码,很是繁琐。有没有一种方法可以消除这样的繁琐操作呢,答案是有的!
按顺序执行如下操作:

  1. 切换到本地仓库目录下

  2. 执行下面命令

阅读全文