How do I list local shared computers through terminal?

I'm looking for a way to see Macs on the local network that have file sharing turned on that i could potentially connect to, through terminal. I've looked into mount and showmount, but i haven't had any luck. Any help is appreciated!

Macbook Pro, Mac OS X (10.6.4)

Posted on Oct 11, 2011 7:43 AM

Reply
3 replies

Oct 12, 2011 9:56 AM in response to woz.was

OK; an additional requirement. Scripting. Quoting from the dns-sd man page:


The dns-sd command is primarily intended for interactive use. Because its command-line arguments and output format are subject to change, invoking it from a shell script will generally be fragile. Additionally, the asynchronous nature of DNS Service Discovery does not lend itself easily to script-oriented programming.

For example, calls like "browse" never complete; the action of performing a "browse" sets in motion machinery to notify the client whenever instances of that service type appear or disappear from the network. These notifications continue to be delivered indefinitely, for minutes, hours, or even days, as services come and go, until the client explicitly terminates the call. This style of asynchronous interaction works best with applications that are either multi-threaded, or use a main event-handling loop to receive keystrokes, network data, and other asynchronous event notifications as they happen.

If you wish to perform DNS Service Discovery operations from a scripting language, then the best way to do this is not to execute the dns-sd command and then attempt to decipher the textual output, but instead to directly call the DNS-SD APIs using a binding for your chosen language.

For example, if you are programming in Ruby, then you can directly call DNS-SD APIs using the dnssd package documented at <http://rubyforge.org/projects/dnssd/>.

Similar bindings for other languages are also in development.


Does that help get you where you want to be? Calling into available Ruby or Python DNS-SD libraries would get you where you want, and there are other choices. Off-hand, I don't know of a bash-friendly interface, but there may be one around.


And stepping back from this request slightly, there are already distributed-management packages which allow connections to remote servers, and managing multiple servers as a unit. With Apple, Apple's ARD tool is one solution, and there are other packages available for Mac OS X and Mac OS X Server and other Unix platforms.


I'd also suggest considering ssh, as telnet is insecure, and as ssh can perform certificate-based and passphrase-based logins.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How do I list local shared computers through terminal?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.