Windows 和 Ubuntu 上 Ping 的区别

发布于 2024-12-29 15:32:21 字数 274 浏览 4 评论 0原文

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

留一抹残留的笑 2025-01-05 15:32:21

由于 Windows 通常默认发送 4 个数据包,因此您可以执行以下操作:

ping -c 4 example.com

在 Ubuntu 上实现与 Windows 相同的行为。如果你想要相反的方式,你可以这样做

ping -t example.com

Since Windows normally sends out 4 packets by default you can do:

ping -c 4 example.com

to achieve the same behavior as Windows on Ubuntu. If you want it the other way around you could do

ping -t example.com
森林迷了鹿 2025-01-05 15:32:21

它们是两个不同的程序,具有不同的默认行为。实际上,您可以使一个行为像另一个一样

在 Windows 上运行:

 ping -t example.com

在 linux 上

 ping -c 10  example.com

查看此处了解详细信息

They are two different programs, that have different default behavior. You can actually make one behave like another

On windows run:

 ping -t example.com

On linux

 ping -c 10  example.com

Look here for details

°如果伤别离去 2025-01-05 15:32:21

我认为这只是平台之间实现的差异。如果你想限制发送/接收的数据包数量,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

桃扇骨 2025-01-05 15:32:21

这是因为 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文