Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open google chrome from terminal?

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.

  • How do I open google chrome from the terminal?
  • What alias could I use to open the current git project in the browser?

More Details:

  1. My localhost is set to port 80.
  2. I store my git repositories in ~/Sites/ - meaning if I wanted to view any project in the browser it would be found here: http://localhost/FILENAME

Thank You

like image 583
Spencer Rohan Avatar asked Jan 14 '16 18:01

Spencer Rohan


People also ask

How do I open chrome console in Linux?

To open the developer console in Google Chrome, open the Chrome Menu in the upper-right-hand corner of the browser window and select More Tools > Developer Tools. You can also use Option + ⌘ + J (on macOS), or Shift + CTRL + J (on Windows/Linux).

How do I get to Google from terminal?

Basic Google search using GooglerOpen your Terminal and type "googler" followed by your search term.


2 Answers

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  
like image 88
John Avatar answered Oct 04 '22 04:10

John


On Linux, just use this command in a terminal:

google-chrome 
like image 32
Hassan Abbasi Avatar answered Oct 04 '22 05:10

Hassan Abbasi