From a89e198221fb670bdcdb1cc0fc786a73c975a28b Mon Sep 17 00:00:00 2001 From: Michele Cereda Date: Sun, 28 Apr 2024 21:09:45 +0200 Subject: [PATCH] chore(osx): add commands to check the dns --- knowledge base/mac os x/README.md | 14 ++++++++++++-- snippets/osx.sh | 4 ++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/knowledge base/mac os x/README.md b/knowledge base/mac os x/README.md index 46076a4..fff10fb 100644 --- a/knowledge base/mac os x/README.md +++ b/knowledge base/mac os x/README.md @@ -61,6 +61,9 @@ lsof -nt -i ':443' # Clear the DNS cache. sudo dscacheutil -flushcache; sudo killall -HUP 'mDNSResponder' +# Resolve names. +dscacheutil -q 'host' -a 'name' 'hostname.or.fqdn' + # Check NFS shares are available on the network. showmount -e 'host' @@ -117,6 +120,15 @@ defaults read '/Library/Preferences/SystemConfiguration/com.apple.smb.server' 'N /usr/libexec/PlistBuddy -c "Print :NetBIOSName" \ '/Library/Preferences/SystemConfiguration/com.apple.smb.server.plist' +# Get the DNS configuration. +scutil --dns + +# Get the proxy configuration. +scutil --proxy + +# Get network information. +scutil --nwi + # Get environment variables from inside launchd. launchctl getenv 'key' @@ -408,8 +420,6 @@ To use any of these key combinations, press and hold the keys immediately after [resize, rotate, or flip an image in preview on mac]: https://support.apple.com/guide/preview/resize-rotate-or-flip-an-image-prvw2015/11.0/mac/13.0 -[further readings]: #further-readings - [defaults]: defaults.md [ghostscript]: ../ghostscript.md diff --git a/snippets/osx.sh b/snippets/osx.sh index f66ee92..37830b6 100644 --- a/snippets/osx.sh +++ b/snippets/osx.sh @@ -1,5 +1,9 @@ #!sh +# Set the host's name. scutil --set 'ComputerName' "$(defaults read '/Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName')" scutil --set 'HostName' "$(defaults read '/Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName')" scutil --set 'LocalHostName' "$(defaults read '/Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName')" + +# Clear the DNS cache. +sudo dscacheutil -flushcache; sudo killall -HUP 'mDNSResponder'