How do I open a file with Chrome from the command line?

后端 未结 15 1232
余生分开走
余生分开走 2020-12-25 09:47

I would like to open a file (index.html) in the current directory with Google Chrome or Chromium from a bash terminal (I\'m using Linux Mint 15). What is the command? I\'v

相关标签:
15条回答
  • 2020-12-25 10:13

    It looks like Chrome is not in your $PATH the way it should be. Easy solution would probably be to uninstall and reinstall Chrome, which should put it in your $PATH. Then

    google-chrome [file] 
    

    should work for you.

    0 讨论(0)
  • 2020-12-25 10:16

    Doing some search for chromium you could do it like chromium-browser path|file.

    0 讨论(0)
  • 2020-12-25 10:16

    For MacOS, with absolute path (if your Chrome is installed in the /Applications folder) in bash CLI use:

     /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome
    

    So, if you want to open the CNN webpage:

     /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome  www.cnn.com
    
    0 讨论(0)
  • 2020-12-25 10:17

    From the bash shell (on Windows), you can use:

    start myFilename.html

    and to open a folder:

    explorer "C:\Program Files\Git"

    Added for reference, since my search landed here, too.

    0 讨论(0)
  • 2020-12-25 10:17

    This solution has always worked for me - open -a "google\ chrome.app" index.html - where "google\ chrome.app" is the name/location of chrome on your system.

    OR

    If Chrome is your default browser, simply - open index.html

    0 讨论(0)
  • 2020-12-25 10:22

    For Mac i'm using

    open -a 'google chrome' /yourPath
    
    0 讨论(0)
提交回复
热议问题