How to Open a Website from Terminal

By  on  

Every once in a while I want to open a website from the terminal ... just because.  Maybe it's because it makes me feel just a bit more hardcore, you know, not clicking a GUI icon.  Anyways, opening a browser via the command line is dead simple:

open https://davidwalsh.name

That execution will open the URL in the system's default browser.  If your prefer a specific browser, you can so specify:

open -a "Google Chrome Canary" http://cnn.com

Open a URL from the command line -- you'll feel like a true pro.

Recent Features

  • By
    JavaScript Promise API

    While synchronous code is easier to follow and debug, async is generally better for performance and flexibility. Why "hold up the show" when you can trigger numerous requests at once and then handle them when each is ready?  Promises are becoming a big part of the JavaScript world...

  • By
    Send Text Messages with PHP

    Kids these days, I tell ya.  All they care about is the technology.  The video games.  The bottled water.  Oh, and the texting, always the texting.  Back in my day, all we had was...OK, I had all of these things too.  But I still don't get...

Incredible Demos

  • By
    Using Dotter for Form Submissions

    One of the plugins I'm most proud of is Dotter. Dotter allows you to create the typical "Loading..." text without using animated images. I'm often asked what a sample usage of Dotter would be; form submission create the perfect situation. The following...

  • By
    Upload Photos to Flickr with PHP

    I have a bit of an obsession with uploading photos to different services thanks to Instagram. Instagram's iPhone app allows me to take photos and quickly filter them; once photo tinkering is complete, I can upload the photo to Instagram, Twitter, Facebook, and...

Discussion

  1. Geopelia

    Like i child…

  2. danny

    Since aliasing gitwww to open the current github repo’s home page, ive saved prob. 2 mins/day. Plus is saves my fingers a trip to the mouse!

    • Ollie

      could you share how you made the alias dynamic to access the current repo’s homepage?

  3. I thought you’re gonna use lynx :))

  4. open didnt work :(
    but start did :) in windows environment

  5. Heh, you got me there! I thought you wrote an article about lynx :-) Thanks for sharing though, it’s especially useful when grabbing stuff using curl or wget…

  6. these days in zsh on OSX you need to wrap the url in quotes

    open 'https://davidwalsh.name/open-website-terminal'
    

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!