useful macOS commands
6/27/2024

本文收集mac常用文章。

# 查看本机ip
ifconfig | grep "inet " | grep -v 127.0.0.1
 
# 同步时间
sudo sntp -sS pool.ntp.org
 
# 关闭网络服务 - 没什么用,遇到网络问题重启就好
networksetup -setairportpower en0 off
 
# 重置 dns
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder
 
# 重启网络服务
sudo ifconfig en0 down
sudo ifconfig en0 up
 
# 查询网络端口对应的设备名称
networksetup -listallhardwareports