creationtriada.blogg.se

Mac network settings command line
Mac network settings command line





mac network settings command line

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 settings command line mac

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. #!/bin/bashlpstat -p | awk '" -P "/Library/Printers/PPDs/Contents/Resources/en.Disclaimer: I'm not the original author of this sheet, but can't recall where I found it. You could deploy this as a shell script file and then execute it (good for both SSH and ARD), or in the case of Apple Remote Desktop's "Send UNIX Command" function, simply throw in the whole script and run it as root. So I wrote up a small script which does this for you. Unfortunately I could not find a command which removed all jobs from all queues. This forces all jobs to be cleared more methods to clear individual jobs or those of a particular are explained in the man page. Note in this example the first hyphen is solo. However, if you do not specify a printer, it will show the jobs for all queues.) lpstat -o Printer_NameTo clear a queue of all jobs, we use lprm. (Note that this will show the jobs for the specified printer. To find out what printers are installed - this one is great for finding the names should you need them with the command above - simply use this: lpstat -pIf you want to see the current jobs on a computer, simply use this command. Here are just a couple of commands I've found very helpful I'm sure there are more if you go looking. And the last thing anyone should have to do is find and clear all printer queues manually.

mac network settings command line

Nothing is more annoying than a printer, well, printing things, when people have walked away leaving nothing but a big pile of print jobs behind. Simply: lpadmin -x Printer_Name Queue Management To remove a printer, it's a far simpler affair. If you're lazy you could always just drag the PPD file over to the Terminal window, too! Before using the command, you'd be best to look in the directory shown and find the filename, and then replicate it in the command line. I'm unsure about other protocols, but perhaps the man page can tell you much more about this command. An IP address belongs in the x.x.x.x bit, and change lpd: to ipp: if that's what you use. Unfortunately, the tradeoff here is that you can't use spaces in the Printer_name, tleast from what I can determine. To add a printer, use this format: lpadmin -p Printer_Name -L "Printer Location" -E -v lpd://x.x.x.x -P /Library/Printers/PPDs/Contents/Resources/en.lproj/Printer_Driver.gzAll you have to do to the above is adjust the settings as necessary. Fortunately, I managed to come across a few Unix commands which, using ssh or ideally Apple Remote Desktop (via the ever-useful 'Send UNIX command' function), can reduce jobs of many minutes, even hours, into seconds. Add to that, I have printers constantly spitting things out because people hit Print a few too many times and clog up the queues. I had issues whereby I would sometimes need to set up a number of computers with a new printer, and then remove it later. Working on a site with a few hundred OS X machines, manually altering each computer's configuration can become very tedious, very fast.







Mac network settings command line