Jump to content

Recommended Posts

Posted

<div class="KonaBody"><p>Using the powerful ‘networksetup’ utility, we can connect to wireless networks directly from the <a href="http://osxdaily.com/category/command-line/">command line</a>. The syntax you’ll want to use is as follows:</p>

<p><code>networksetup -setairportnetwork Airport [router SSID] [password]</code></p>

<p>For example, if I’m connecting to a wireless router with an SSID of “OutsideWorld” and the password is “68broncos” this would be the syntax:</p>

<p><code>networksetup -setairportnetwork Airport OutsideWorld 68broncos</code></p>

<p>You could combine this tip with <a href="http://osxdaily.com/2011/04/11/use-aliases-to-create-ssh-shortcuts/">using aliases to create shortcuts</a> and eliminate the need for the lengthy command. An example to put in your .bash_profile would be:</p>

<p><code style="font-size:0.95em;">alias publicwifi='networksetup -setairportnetwork Airport OutsideWorld 68broncos'</code></p>

<p>Now you would only have to type ‘publicwifi’ at the command line and you’ll connect to the specified router. Remember that this will store the wireless access points password in plain text, so if someone was able to access your .bash_profile they would also be able to see that wireless routers password.</p>

<p>If you want to explore more of what networksetup has to offer, type ‘man networksetup’ and you’ll find an astonishing amount of powerful uses for the command line utility.</p>

</div>

<p><a href="http://feedads.g.doubleclick.net/~a/Ohq_XggrwEDJelhmse1Rg0To34Y/0/da"><img src="http://feedads.g.doubleclick.net/~a/Ohq_XggrwEDJelhmse1Rg0To34Y/0/di" border="0" ismap="true"></img></a><br/>

<a href="http://feedads.g.doubleclick.net/~a/Ohq_XggrwEDJelhmse1Rg0To34Y/1/da"><img src="http://feedads.g.doubleclick.net/~a/Ohq_XggrwEDJelhmse1Rg0To34Y/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">

<a href="http://feeds.feedburner.com/~ff/osxdaily?a=DXUbWNLW_Fk:0TZcQZCyCNs:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=DXUbWNLW_Fk:0TZcQZCyCNs:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/osxdaily?i=DXUbWNLW_Fk:0TZcQZCyCNs:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=DXUbWNLW_Fk:0TZcQZCyCNs:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/osxdaily?i=DXUbWNLW_Fk:0TZcQZCyCNs:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=DXUbWNLW_Fk:0TZcQZCyCNs:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=DXUbWNLW_Fk:0TZcQZCyCNs:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=qj6IDK7rITs" border="0"></img></a>

</div><img src="http://feeds.feedburner.com/~r/osxdaily/~4/DXUbWNLW_Fk" height="1" width="1"/>

 

View the full article

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic


×
×
  • Create New...