![]() Obtain the dns servers used on the Wi-Fi interface: networksetup -getdnsservers Wi-Fi STUDENT COMMANDS FOR TERMINAL MAC CHEAT SHEET MANUALRenew a dhcp lease in a script: echo "add State:/Network/Interface/en0/RefreshConfiguration temporary" | sudo scutilĬonfigure a manual static IP address: networksetup -setmanual Wi-Fi 10.0.0.2 255.255.255.0 10.0.0.1Ĭonfigure the dns servers for a given network interface: networksetup -setdnsservers Wi-Fi 10.0.0.2 10.0.0.3 Renew DHCP leases: ipconfig set en1 BOOTP & ipconfig set en1 DHCP Set the interface called Wi-Fi to obtain it if it isn’t already: networksetup -setdhcp Wi-Fi Rename the network service called Ethernet to the word Wired: networksetup -renamenetworkservice Ethernet Wiredĭisable a network interface: networksetup -setnetworkserviceenabled offĬhange the order of your network services: networksetup -ordernetworkservices “Wi-Fi” “USB Ethernet” List all of the network interfaces on the system: networksetup -listallnetworkservices Switch the active location to a location called Work, but also show the GUID of that location so we can make scripties with it laters: scselect Work ![]() Switch the active location to a location called Work: networksetup -switchlocation Work Obtain the active location the system is using: networksetup -getcurrentlocationĬreate a network location called Work and populate it with information from the active network connection: networksetup -createlocation Work populateĭelete a network location called Work: networksetup -deletelocation Work Show a list of locations on the computer: networksetup -listlocations Get information about how en0 got its DHCP on: ipconfig getpacket en1 View the dns server for en0: ipconfig getoption en0 domain_name_server ![]() View the subnet mask of en0: ipconfig getoption en0 subnet_mask Same thing, but setting and echoing a variable: ip=`ipconfig getifaddr en0` echo $ip Get an ip address for en0: ipconfig getifaddr en0 Mac Network Commands Cheat SheetĪfter writing up the presentation for MacSysAdmin in Sweden, I decided to go ahead and throw these into a quick cheat sheet for anyone who’d like to have them all in one place. Also, note that this is from 2016, many things may have changed, and I don't use macOS anymore, so I probably can't help in case of questions, but maybe someone else can. Note: Since this seems to be helpful to some people, I formatted it to improve readability of the original. If you know the author, please let me know so I give the attribution. Disclaimer: I'm not the original author of this sheet, but can't recall where I found it.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |