linux命令集锦

November 27, 2019
linux 命令行

10 用awk分析文件

9 mac下查看进程

lsof -i tcp:1088

8 网络不通,如何诊断

缘由:

不通

您iptables -L 查看一下您服务器出方向是否对端口有禁行呢?

查看防火墙

防火墙没有限制规则的,麻烦您找个时间登录服务器做下端口探测,我们看下,谢谢, 方法参考这里

网络路由

查看具体端口不通的路由节点是在IP 122.189.40.42查询为湖北咸宁联通运营商,已经出了阿里云机房网络,应该是在对应本地运营商骨干网络吧, 建议您可以尝试根据此路由测试结果进行运营商报障,或者是尝试更换下服务器公网IP,换成EIP绑定ECS使用,这样就可以随时进行换IP了,您可以参考一下。

7 查看外部连接

netstat -tonp

居然这效果:

Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name     Timer
tcp        0      0 172.26.71.242:60612     172.26.71.241:3306      ESTABLISHED 13488/java           keepalive (6434.70/0/0)
tcp        0      0 172.26.71.242:60626     172.26.71.241:3306      ESTABLISHED 13488/java           keepalive (6434.72/0/0)
tcp        0      0 172.26.71.242:60618     172.26.71.241:3306      ESTABLISHED 13488/java           keepalive (6434.71/0/0)
tcp        0      0 172.26.71.242:36056     100.100.30.25:80        ESTABLISHED 1917/AliYunDun       off (0.00/0/0)
tcp        0      0 172.26.71.242:60616     172.26.71.241:3306      ESTABLISHED 13488/java           keepalive (6434.71/0/0)
tcp        0    212 172.26.71.242:22        172.26.71.240:42928     ESTABLISHED 13663/sshd: root@pt  on (0.20/0/0)
tcp        0      0 172.26.71.242:49022     172.26.71.241:9600      ESTABLISHED 13488/java           off (0.00/0/0)
tcp        0      0 172.26.71.242:60614     172.26.71.241:3306      ESTABLISHED 13488/java           keepalive (6434.70/0/0)
tcp        0      0 172.26.71.242:60624     172.26.71.241:3306      ESTABLISHED 13488/java           keepalive (6434.72/0/0)
tcp        0      0 172.26.71.242:60608     172.26.71.241:3306      ESTABLISHED 13488/java           keepalive (6434.70/0/0)
tcp        0      0 172.26.71.242:60610     172.26.71.241:3306      ESTABLISHED 13488/java           keepalive (6434.70/0/0)
tcp        0      0 172.26.71.242:60622     172.26.71.241:3306      ESTABLISHED 13488/java           keepalive (6434.72/0/0)
tcp        0      0 172.26.71.242:60620     172.26.71.241:3306      ESTABLISHED 13488/java           keepalive (6434.71/0/0)
tcp        0      0 172.26.71.242:22        172.26.71.240:41632     ESTABLISHED 13023/sshd: root@no  keepalive (6594.66/0/0)
tcp        0      0 172.26.71.242:43396     172.26.71.241:6379      ESTABLISHED 13488/java           keepalive (6375.32/0/0)

统计外部连接的量,比如netstat -an | grep 6379 | grep EST | wc -l能统计出连接到这个端口的连接数量

6 tar的用法

5 centos卸载自带的jdk

rpm -qa|grep jdk查看版本,显示:jdk-1.7.0_71-fcs.x86_64

rpm -e --nodeps jdk-1.7.0_71-fcs.x86_64卸载

4 查看系统版本

centos:

CentOS Linux release 7.3.1611 (Core) 
kernel-3.10.0-514.el7.x86_64

3 make时/bin/sh: cc: command not found

sudo yum -y install gcc gcc-c++ libstdc++-devel # 安装类库
make MALLOC=libc
rpm -qa|grep cc # 检查一下程序是否安装

2 搜索大文件

find / -xdev -size +100M -exec ls -l {} \; # 大于100M的文件全给我出来

1 改变目录所有者

chgrp GROUPNAME DIR -r # 所属用户组 chown USERNAME DIR -r # 所属用户


loading