红穆笔记

ping

向網絡主機發送 ICMP (ECHO_REQUEST) 數據包。 另請參閱:`mtr`

100% 瀏覽器本地處理 0 數據上傳

常用示例

Ping 主機

ping {{主機地址}}

僅 Ping 主機特定次數

ping -c {{次數}} {{主機地址}}

Ping 主機,指定請求之間的間隔(以秒爲單位)(默認爲 1 秒)

ping -i {{間隔秒數}} {{主機地址}}

Ping 主機而不嘗試查找地址的符號名稱

ping -n {{主機地址}}

Ping 主機並在收到數據包時響鈴(如果您的終端支持)

ping -a {{主機地址}}

如果沒有收到響應,也顯示一條消息

ping -O {{主機地址}}

Ping 主機,指定 ping 次數、每個數據包的響應超時 (`-W`)和整個 ping 運行的總時間限制 (`-w`)

ping -c {{次數}} -W {{響應超時秒數}} -w {{總的等待超時秒數}} {{主機地址}}

提示:花括號{{…}}是需要替換的參數(路徑、文件名等);命令只在本機終端執行,本站不保存任何輸入。

英文原文對照

展開英文說明與示例(來源 tldr-pages)

Send ICMP ECHO_REQUEST packets to network hosts. See also: `mtr`. More information

Ping a host with IP `10.0.0.1` (Note: `10.0.0.1` can be shortened to `10.1`)

ping 10.0.0.1

Ping a host only a specific number of times

ping -c {{count}} {{host}}

Ping host, specifying the interval in seconds between requests (default is 1 second)

ping -i {{seconds}} {{host}}

Ping host without trying to look up symbolic names for addresses

ping -n {{host}}

Ping host and ring the bell when a packet is received (if your terminal supports it)

ping -a {{host}}

Also display a message if no response was received

ping -O {{host}}

Ping a host with specific [c]ount of pings, per-packet time to [W]ait for a response, and total [w]ait time limit of the entire ping run

ping -c {{count}} -W {{seconds}} -w {{seconds}} {{host}}

Ping all IPv6 local network hosts

ping -6 ff02::1%{{eth0}}

命令信息

命令名ping
用途向網絡主機發送 ICMP (ECHO_REQUEST) 數據包。 另請參閱:`mtr`
適用平臺通用,macOS
示例數量7 條
官方文檔https://manned.org/ping
數據來源tldr-pages(CC-BY-4.0)· 社區中文翻譯

常見問題

ping 命令是做什麼的?

向網絡主機發送 ICMP (ECHO_REQUEST) 數據包。 另請參閱:`mtr`

ping 怎麼用?

頁面按場景列出了7 條常用示例:每條示例先說明用途,再給出可直接複製的完整命令(花括號裏是需要替換的參數)。

ping 最常用的操作是什麼?

Ping 主機:ping {{主機地址}}

命令裏的花括號是什麼意思?

花括號{{…}}表示需要替換成你自己的值,例如路徑、文件名;同名參數方括號(如 [-C|--directory])表示可選寫法。