Linux就业技术指导(五):Linux运维核心管理命令详解 (10)

(2)通过pid跟踪进程调用库函数

[root@localhost tmp]# pgrep -l nginx 3967 nginx 3968 nginx #nginx的worker进程的pid号 [root@localhost tmp]# ltrace -p 3968 使用-p指定进程号 __errno_location() = 0x7f0a392e1768 gettimeofday(0x7fff8f684cd0, NULL) = 0 memcpy(0x6b281f, "14", 2) = 0x6b281f memcpy(0x6b2826, "2018", 4) = 0x6b2826 memcpy(0x6b282b, "12", 2) = 0x6b282b memcpy(0x6b282e, "28", 2) = 0x6b282e memcpy(0x6b2831, "30", 2) = 0x6b2831 localtime_r(0x7fff8f684c88, 0x7fff8f684d20, 0x48400a, 12339, 0x7fff8f684b52) = 0x7fff8f684d20 memcpy(0x6b22fc, "2018", 4) = 0x6b22fc memcpy(0x6b2302, "1", 1) = 0x6b2302 memcpy(0x6b2304, "14", 2) = 0x6b2304 memcpy(0x6b2308, "7", 1) = 0x6b2308 memcpy(0x6b230a, "28", 2) = 0x6b230a memcpy(0x6b230d, "30", 2) = 0x6b230d memcpy(0x6b2f91, "14", 2) = 0x6b2f91 memcpy(0x6b2f98, "2018", 4) = 0x6b2f98 memcpy(0x6b2f9e, "7", 1) = 0x6b2f9e memcpy(0x6b2fa0, "28", 2) = 0x6b2fa0 memcpy(0x6b2fa3, "30", 2) = 0x6b2fa3 memcpy(0x6b2fa8, "5", 1) = 0x6b2fa8 memcpy(0x6b2faa, "0", 1) = 0x6b2faa memcpy(0x6b364e, "2018", 4) = 0x6b364e memcpy(0x6b3654, "1", 1) = 0x6b3654 memcpy(0x6b3656, "14", 2) = 0x6b3656 memcpy(0x6b365a, "7", 1) = 0x6b365a memcpy(0x6b365c, "28", 2) = 0x6b365c memcpy(0x6b365f, "30", 2) = 0x6b365f memcpy(0x6b3663, "5", 1) = 0x6b3663 memcpy(0x6b3666, "0", 1) = 0x6b3666 memcpy(0x6b3cb4, "14", 2) = 0x6b3cb4 memcpy(0x6b3cb8, "7", 1) = 0x6b3cb8 memcpy(0x6b3cba, "28", 2) = 0x6b3cba memcpy(0x6b3cbd, "30", 2) = 0x6b3cbd epoll_wait(8, 0x2639990, 512, 0xffffffff, 0x7fff8f684b52 二,Linux核心网络管理命令 2.1 ip:网络配置工具 2.1.1 命令解释

功能说明:

ip命令是iproute软件包中的一个强大的网络配置工具,用于显示或管理Linux系统的路由,网络设备,策略路由和隧道

选项说明:

参数选项 解释说明(带@的为重点)
-s   输出更详细的信息,为了相似更详细的信息,可重复使用此选项  
-r   显示主机时,不使用IP地址,而是使用主机的域名  
网络对象   指定要管理的网络对象(link:网络设备 address:IP地址 addrlabel:协议地址标签管理 route:路由表 rule:策略路由表 runnel:IP隧道 )  
help   ip help:查看ip命令的帮助 ip【object】help:查看指定的网络对象的帮助  
操作命令   对指定的网络对象完成的具体操作。通常,每一个具体操作的命令后面又有一组相关的命令选项。不同的操作对象所支持的操作命令也不同。下面按照操作的网络对象给出所支持的常见操作命令  
  link对象支持的操作命令:set(修改设备属性),show(显示设备属性)  
  address对象支持的操作命令:add(添加协议地址),del(删除协议地址),flush(清除协议地址),show(查看协议地址)  
  addrlabel对象支持的操作命令:add,del,list,flush  
  route对象支持的操作命令:add,change,replace,delete,show,flush,get  
  rule对象支持的操作命令:add,delete,flush,show  
  tunnel对象支持的操作命令:add,change,delete,prl,show  
2.1.2 使用范例

(1)显示网络设备属性

[root@Mr_chen ~]# ip link show eth0 #显示eth1网卡属性 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:0c:29:a8:ca:50 brd ff:ff:ff:ff:ff:ff [root@Mr_chen ~]# ip -s link show eth0 #显示详细属性 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:0c:29:a8:ca:50 brd ff:ff:ff:ff:ff:ff RX: bytes packets errors dropped overrun mcast #显示每个网络设备上数据包的统计信息 37242 432 0 0 0 0 TX: bytes packets errors dropped carrier collsns 22769 178 0 0 0 0 [root@Mr_chen ~]# ip -s -s link show eth0 #使用两个-s显示更详细属性 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:0c:29:a8:ca:50 brd ff:ff:ff:ff:ff:ff RX: bytes packets errors dropped overrun mcast 44464 523 0 0 0 0 RX errors: length crc frame fifo missed 0 0 0 0 0 TX: bytes packets errors dropped carrier collsns 26699 209 0 0 0 0 TX errors: aborted fifo window heartbeat 0 0 0 0

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zygwxj.html