Windows 和 Ubuntu 上 Ping 的区别
我在 Ubuntu 终端上摆弄 ping 命令,发现了一些让我困惑的东西:
终端进行大量的发送/接收,但 Windows 命令提示符只发送几个数据包然后退出。我能够获得结果的唯一方法是使用 Ctl+C 停止 Ubuntu 终端上的输出。
这是怎么回事?我知道 Windows 命令提示符和 Ubuntu 上的终端有很大的区别,但我不明白这个区别是什么。是否有可能我没有使用正确的语法? (ping example.com
)
如有任何想法/帮助,我们将不胜感激。
I was messing around with the ping
command on the terminal in Ubuntu, and I found something that confused me:
The Terminal makes an insane amount of send/receives, yet the Windows command prompt only sends a few packets and then exits. The only way I have been able to get a result is to use Ctl+C
to stop the output on the Ubuntu Terminal.
What is going on here? I know that there is a large difference between the Windows command prompt and the terminal on Ubuntu, but I cannot figure out what that difference is. Is it possible that I am not using the correct syntax? (ping example.com
)
Any ideas/help is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
由于 Windows 通常默认发送 4 个数据包,因此您可以执行以下操作:
在 Ubuntu 上实现与 Windows 相同的行为。如果你想要相反的方式,你可以这样做
Since Windows normally sends out 4 packets by default you can do:
to achieve the same behavior as Windows on Ubuntu. If you want it the other way around you could do
它们是两个不同的程序,具有不同的默认行为。实际上,您可以使一个行为像另一个一样
在 Windows 上运行:
在 linux 上
查看此处了解详细信息
They are two different programs, that have different default behavior. You can actually make one behave like another
On windows run:
On linux
Look here for details
我认为这只是平台之间实现的差异。如果你想限制发送/接收的数据包数量,Ubuntu ping 有 -c 标志,指示命令在发送/接收一定数量的请求后退出。
http://manpages.ubuntu.com/manpages/hardy/man8/ping .8.html
I think it is just a difference in implementation between platforms. If you want to limit the number of packets sent/received, Ubuntu ping has the -c flag that instructs the command to exit after a certain number of sends/receive requests.
http://manpages.ubuntu.com/manpages/hardy/man8/ping.8.html
这是因为 Windows 上的 ping 应用程序与 Linux 上不同。 Windows 只运行几个来给您提供信息,而 Linux 则无限地向您显示当前的 ping。
this is because the ping application on windows is different than linux. windows runs only a few to give you the information, whereas linux infinitely shows you the current ping.