The Linux timeout command

  • fennng 

Sometimes, you may want to run some network command which may take long time to run. If you want to cancel the command which runs too long, you can use the timeout command.

I use the MPV command to collection some live stream info. The command may stuck when testing a bad url. The timeout command comes handy here.

timeout -k 60 60 mpv –no-video –length=0 –network-timeout=10 “” | grep “Playing\|Video”