Reputation:
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've tried the intuitive approaches and have done a few stack and google searches to no avail, oddly overlooked (perhaps painfully obvious).
hermes@hades ~/coding/.../public $ google-chrome index.html
google-chrome: command not found
hermes@hades ~/coding/.../public $ google-chromium index.html
google-chromium: command not found
Upvotes: 78
Views: 161553
Reputation: 87
You need to find the location of chrome.exe on your system. If Chrome was installed into a default location, the Shell command in Windows looks like this:
"C:\Program Files\Google\Chrome\Application\chrome.exe"
Further, if you want to open a particular page in Chrome:
"C:\Program Files\Google\Chrome\Application\chrome.exe" "https://google.com"
Upvotes: 0
Reputation: 63
None of the other things I saw worked for me, but I later found this that worked:
explorer.exe index.html
Upvotes: 0
Reputation: 23
Try this
start chrome "file or path"
same for FireFox
start firefox "file or path"
This worked for me.
Upvotes: -1
Reputation: 1378
You can open a file using below terminal commands (Linux)
google-chrome < filepath >
google-chrome --new-window < filepath >
google-chrome --incognito (--incongnito-mode) < filepath >
<filepath> = localhost/test/../filename.html
Upvotes: 5
Reputation: 61
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.
Upvotes: 5
Reputation: 504
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
Upvotes: 4
Reputation: 289695
As others stated, the solution is to use:
google-chrome www.google.com
You can also use --incognito
to open them in incognito mode:
google-chrome --incognito www.google.com
Note you can open multiple pages at the same time by just placing them one after the other:
google-chrome www.google.com www.yahoo.com
If you want to open them from a file, use the command substitution $()
to open it and process on the fly:
google-chrome $(<file)
Upvotes: 1
Reputation: 15755
Just type in the program name followed by the file:
google-chrome {file-path}
ex:
google-chrome ~/index.html
Upvotes: 73
Reputation: 561
Try
open {filename}
if it's an .html
file it should open in your default browser
Upvotes: 56
Reputation: 441
With Chrome not the default browser, this worked for me under Windows 10:
start "New Chrome Window Title" /d "C:\Program Files (x86)\Google\Chrome\Application" "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --new-window "file://C:/Folder/SubFolder/Sub Subfolder/thisfile.html"
You'll need:
file://
" onto the URL;chrome.exe
;These should be reasonably doable in a .bat
or .cmd
file, using FOR
commands and the text-replacing features of the SET
command; or do all that in a .vbs
or .ps1
script which could be called from the batch file, etc.
But the basic syntax appears sound.
Upvotes: 3
Reputation: 21
start index.html
This worked for me. Hope it does for you too.
Upvotes: 2
Reputation: 1071
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
Upvotes: 10
Reputation: 1172
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.
Upvotes: 24
Reputation: 145
If Chrome is your main browser, just use
see your_file.html
Upvotes: 8
Reputation: 6878
Try
/opt/google/chrome/google-chrome --allow-file-access-from-files index.html
Or
/usr/bin/google-chrome --allow-file-access-from-files index.html
--allow-file-access-from-files
will relax some security settings , useful for testing with local files.
Upvotes: 1
Reputation: 75488
Doing some search for chromium you could do it like chromium-browser path|file
.
Upvotes: 17
Reputation: 750
On Ubuntu 12.04, at least, it's /opt/google/chrome/chrome
; I've also got a symlink to it at /usr/bin/google-chrome
Upvotes: 2