网络操作命令、网络操作工具、系统资源查看
查看IP地址的方法
为什么要查看IP?
ip -4 addr #显示主机的ipv4地址
ip -6 addr #显示主机的ipv6地址
禁用、启用网络接口
启动网卡: service network start
禁用网卡: service network stop
PING命令
ping的作用:连通性检查
ping -c <测试数据包数量> <目的主机地址>
[[email protected] ~]# ping www.163.com
PING www.163.com (121.10.121.123) 56(84) bytes of data.
64 bytes from 121.10.121.123: icmp_seq=1 ttl=56 time=16.7 ms
64 bytes from 121.10.121.123: icmp_seq=2 ttl=56 time=19.3 ms
64 bytes from 121.10.121.123: icmp_seq=3 ttl=56 time=16.3 ms
64 bytes from 121.10.121.123: icmp_seq=4 ttl=56 time=15.8 ms
64 bytes from 121.10.121.123: icmp_seq=5 ttl=56 time=17.7 ms
64 bytes from 121.10.121.123: icmp_seq=6 ttl=56 time=17.9 ms
64 bytes from 121.10.121.123: icmp_seq=7 ttl=56 time=17.0 ms
[[email protected] ~]# ping -c 5 www.baidu.com
PING www.baidu.com (14.215.177.39) 56(84) bytes of data.
64 bytes from 14.215.177.39: icmp_seq=1 ttl=56 time=11.2 ms
64 bytes from 14.215.177.39: icmp_seq=2 ttl=56 time=9.54 ms
64 bytes from 14.215.177.39: icmp_seq=3 ttl=56 time=12.5 ms
64 bytes from 14.215.177.39: icmp_seq=4 ttl=56 time=11.8 ms
64 bytes from 14.215.177.39: icmp_seq=5 ttl=56 time=8.56 ms
--- www.baidu.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4017ms
rtt min/avg/max/mdev = 8.564/10.763/12.594/1.489 ms
netstat查看连接端口
netstat -a #显示所有连接中的socket
netstat -n #显示端口数字而不是协议名
netstat -p #显示建立连接的进程信息
和grep一起使用: netstat -anp|grep:80
[[email protected] ~]# netstat -anp|grep 3306
lsof命令
查看端口占用
lsof -i:<port>
[[email protected] ~]# lsof -i:22
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
sshd 1807 root 3u IPv4 14226 0t0 TCP *:ssh (LISTEN)
sshd 1807 root 4u IPv6 14228 0t0 TCP *:ssh (LISTEN)
sshd 4031 root 3r IPv4 33744 0t0 TCP 192.168.1.103:ssh->192.168.1.104:61379 (ESTABLISHED)
top命令
top命令用来显示执行中的程序进程,使用权限是所有用户
实时动态的区间内计算的,查看CPU,内存的使用情况
free命令
free命令用来显示内存的使用情况,使用权限是所有用户
free -m 以兆的形式显示
df命令
df命令用于显示目前在Linux系统上的文件系统的磁盘使用情况统计