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
    LightFace:  Facebook Lightbox for MooTools

    One of the web components I've always loved has been Facebook's modal dialog.  This "lightbox" isn't like others:  no dark overlay, no obnoxious animating to size, and it doesn't try to do "too much."  With Facebook's dialog in mind, I've created LightFace:  a Facebook lightbox...

  • By
    Designing for Simplicity

    Before we get started, it's worth me spending a brief moment introducing myself to you. My name is Mark (or @integralist if Twitter happens to be your communication tool of choice) and I currently work for BBC News in London England as a principal engineer/tech...

Incredible Demos

  • By
    MooTools 1.3 Browser Object

    MooTools 1.3 was just released and one of the big additions is the Browser object.  The Browser object is very helpful in that not only do you get information about browser type and browser versions, you can gain information about the user's OS, browser plugins, and...

  • By
    CSS Counters

    Counters.  They were a staple of the Geocities / early web scene that many of us "older" developers grew up with;  a feature then, the butt of web jokes now.  CSS has implemented its own type of counter, one more sane and straight-forward than the ole...

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!