Last Updated: February 25, 2016
· bunnymatic

get ip address of SMB network machine

Given Mac's on a local network, you can look up the IP by machine name using

smbutil lookup machine_name

The output is very verbose. If you want to use it to help ssh between machines, it ends up being a bunch of cut and paste. Add the following to your bash profile

smbip() {
  smbutil lookup $1 | head -1 | ruby -nle 'puts $_.split.last;'

Then you can

ssh `smbip machine_name`