windows_browser.md

April 24, 2025 ยท View on GitHub

Linking your default browser to Ubuntu

To be sure that you can interact with your browser installed on Windows from your Ubuntu terminal, we need to set it as your default browser there.

:warning: You need to execute at least one of the following commands below:

Google Chrome as your default browser

Run the command:

  ls /mnt/c/Program\ Files\ \(x86\)/Google/Chrome/Application/chrome.exe

Did you get an error like ls: cannot access...?

Yes, I had an error

Run the following commands:

  echo "export BROWSER=\"/mnt/c/Program Files/Google/Chrome/Application/chrome.exe\"" >> ~/.zshrc
  echo "export GH_BROWSER=\"'/mnt/c/Program Files/Google/Chrome/Application/chrome.exe'\"" >> ~/.zshrc
No, everything was fine

Run the following commands:

  echo "export BROWSER=\"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe\"" >> ~/.zshrc
  echo "export GH_BROWSER=\"'/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe'\"" >> ~/.zshrc

Mozilla Firefox as your default browser

Run the command:

  ls /mnt/c/Program\ Files\ \(x86\)/Mozilla\ Firefox/firefox.exe

Did you get an error like ls: cannot access...?

Yes, I had an error

Run the following commands:

  echo "export BROWSER=\"/mnt/c/Program Files/Mozilla Firefox/firefox.exe\"" >> ~/.zshrc
  echo "export GH_BROWSER=\"'/mnt/c/Program Files/Mozilla Firefox/firefox.exe'\"" >> ~/.zshrc
No, everything was fine

Run the following commands:

  echo "export BROWSER=\"/mnt/c/Program Files (x86)/Mozilla Firefox/firefox.exe\"" >> ~/.zshrc
  echo "export GH_BROWSER=\"'/mnt/c/Program Files (x86)/Mozilla Firefox/firefox.exe'\"" >> ~/.zshrc

Microsoft Edge as your default browser

Run the commands:

  echo "export BROWSER=\"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe\"" >> ~/.zshrc
  echo "export GH_BROWSER=\"'/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe'\"" >> ~/.zshrc

Restart your terminal.

Then please make sure that the following command returns "Browser defined ๐Ÿ‘Œ":

[ -z "$BROWSER" ] && echo "ERROR: please define a BROWSER environment variable โš ๏ธ" || echo "Browser defined ๐Ÿ‘Œ"

If it does not,

:heavy_check_mark: If you got this message, you can continue :+1:

:x: If not, choose a browser in the list above and execute the corresponding command. Then don't forget to reset your terminal:

exec zsh

Do not hesitate to contact a teacher.