I'm trying to create an alias that opens google chrome to localhost. Port 80 in this case.
I'd also really like to be able to be in any git directory and have it open that specific project in the browser, but I'm not sure if that's even possible.
More Details:
http://localhost/FILENAME
Thank You
This question is related to
git
bash
google-chrome
terminal
alias
I'm not sure how extensively you've searched, but this seems to be similar to what you're searching for:
https://apple.stackexchange.com/questions/83630/create-a-terminal-command-to-open-file-with-chrome
(I just assumed you're using Mac since you used the word "terminal")
From the macOS Terminal, use open
with the -a
flag and give the name of the app you want to open. In this case "Google Chrome". You may pass it a file or URL you want it to open with.
open -a "Google Chrome" index.html
In Terminal, type open -a Google\ Chrome
This will open Google Chrome application without any need to manipulate directories!
on mac terminal (at least in ZSH): open stackoverflow.com
(opens site in new tab in your chrome default browser)
On Linux, just use this command in a terminal:
google-chrome
just type
google-chrome
it works. Thanks.
Use command
google-chrome-stable
We can also use command
google-chrome
To open terminal but in my case when I make an interrupt ctrl + c
then it get closed so I would recommend to use google-chrome-stable
instead of google-chrome
If you just want to open the Google Chrome from terminal instantly for once then
open -a "Google Chrome"
works fine from Mac Terminal.
If you want to use an alias to call Chrome from terminal then you need to edit the bash profile and add an alias on ~/.bash_profile
or ~/.zshrc
file.The steps are below :
~/.bash_profile
or ~/.zshrc
file and add the following line alias chrome="open -a 'Google Chrome'"
chrome filename
for opening a local file.chrome url
for opening url.Source: Stackoverflow.com