Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/42.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 带绝对时间戳的ping_Linux_Ping - Fatal编程技术网

Linux 带绝对时间戳的ping

Linux 带绝对时间戳的ping,linux,ping,Linux,Ping,是否可以将每个ping数据包的系统时间放在ping之前 例如,当我每秒ping 1000次时,我们会看到如下情况: # ping 9.0.0.150 -i 0.001 PING 9.0.0.150 (9.0.0.150) 56(84) bytes of data. 64 bytes from 9.0.0.150: icmp_req=1 ttl=64 time=0.531 ms 64 bytes from 9.0.0.150: icmp_req=2 ttl=64 time=0.473 ms 64

是否可以将每个ping数据包的系统时间放在ping之前

例如,当我每秒ping 1000次时,我们会看到如下情况:

# ping 9.0.0.150 -i 0.001
PING 9.0.0.150 (9.0.0.150) 56(84) bytes of data.
64 bytes from 9.0.0.150: icmp_req=1 ttl=64 time=0.531 ms
64 bytes from 9.0.0.150: icmp_req=2 ttl=64 time=0.473 ms
64 bytes from 9.0.0.150: icmp_req=3 ttl=64 time=0.472 ms
64 bytes from 9.0.0.150: icmp_req=4 ttl=64 time=0.497 ms
# ping 9.0.0.150 -i 0.001
PING 9.0.0.150 (9.0.0.150) 56(84) bytes of data.
12345123.122122 64 bytes from 9.0.0.150: icmp_req=1 ttl=64 time=0.531 ms
12345123.123122 64 bytes from 9.0.0.150: icmp_req=2 ttl=64 time=0.473 ms
12345123.124122 64 bytes from 9.0.0.150: icmp_req=3 ttl=64 time=0.472 ms
12345123.125122 64 bytes from 9.0.0.150: icmp_req=4 ttl=64 time=0.497 ms
我想要的是这样的东西:

# ping 9.0.0.150 -i 0.001
PING 9.0.0.150 (9.0.0.150) 56(84) bytes of data.
64 bytes from 9.0.0.150: icmp_req=1 ttl=64 time=0.531 ms
64 bytes from 9.0.0.150: icmp_req=2 ttl=64 time=0.473 ms
64 bytes from 9.0.0.150: icmp_req=3 ttl=64 time=0.472 ms
64 bytes from 9.0.0.150: icmp_req=4 ttl=64 time=0.497 ms
# ping 9.0.0.150 -i 0.001
PING 9.0.0.150 (9.0.0.150) 56(84) bytes of data.
12345123.122122 64 bytes from 9.0.0.150: icmp_req=1 ttl=64 time=0.531 ms
12345123.123122 64 bytes from 9.0.0.150: icmp_req=2 ttl=64 time=0.473 ms
12345123.124122 64 bytes from 9.0.0.150: icmp_req=3 ttl=64 time=0.472 ms
12345123.125122 64 bytes from 9.0.0.150: icmp_req=4 ttl=64 time=0.497 ms

前缀中的数字是系统时间。

可能是这样的吗

ping 9.0.0.150 -i 0.001 | while read line
do
   echo $(cut -f1 -d' ' /proc/uptime) $line
done