4 ms·
#!/bin/zsh ip addr | grep $localNetworkPrefix ping $localGateway ping 1.1.1.1 ping $DNS01 ping $DNS02 open -a Safari https://downdetecto
by artificialLimbs 5y ago
#!/bin/zsh
ip addr | grep $localNetworkPrefix
ping $localGateway
ping 1.1.1.1
ping $DNS01
ping $DNS02
open -a Safari https://downdetector.com/status/%1
Do `chmod +x ./scriptname.sh` to make executable and run with argument (e.g. net.sh facebook) to check a particular service.
Edit: Thanks @Shared404
- Shared404 5y ago> Edit: Not sure how to do single spaced newline here. If you prepend each line with 4 spaces it'll format as code.
- sbr464 5y agoI believe only 2 spaces are required.
- X-Istence 5y agoip doesn't exist on macOS. That is a Linuxism. You can use the following: netstat -rn -f inet | grep default | head -n 1 | awk '{ print $2 }' To get the default gateway that is the preferred one on macOS, so you don't need to hard code it. scutil --dns Will display the DNS servers/split DNS configuration as well.
- mzi 5y agoI'm on my phone but I think you can do this if you're using awk anyway: netstat -rn -f inet | awk '/default/ {print $2;exit}'
- mobilemidget 5y agoI still type 'ip a s' on osx machines multiple times a week, even though I know it doesn't exist for many years. If on wifi one can also simply option click the wifi icon in the menu bar. Maybe some people don't know yet, it was a late discovery for me option click shows more information there. For quick internet access check I like 'curl ipconfig.sh'