ping 60 秒

mgm*_*hir 6 command-line networking ping

我想 ping 一个 IP 地址 60 秒。就像在 Windows 中一样,您可以使用 '-t' 标志指定时间。

ping 192.168.1.1 -t60
Run Code Online (Sandbox Code Playgroud)

在Linux中可能吗?

ste*_*ver 21

man ping

   -w deadline
          Specify  a  timeout, in seconds, before ping exits regardless of
          how many packets have been sent or received. In this  case  ping
          does  not  stop after count packet are sent, it waits either for
          deadline expire or until count probes are answered or  for  some
          error notification from network.
Run Code Online (Sandbox Code Playgroud)

前任。

$ time ping -w60 192.168.1.65 &>/dev/null

real    1m0.001s
user    0m0.008s
sys     0m0.000s
Run Code Online (Sandbox Code Playgroud)