Launching Web Browser from Linux Terminal (using ssh)

browser, linux, ssh, terminal

Solution

graphic applications need an environment variable called `$DISPLAY` to start.

Start your browser in the terminal via ssh like this for exmaple:

user@host:~# DISPLAY=:0 firefox http://www.google.com

The browser will be started in the gui. In your case:

user@host:~# DISPLAY=:0 midori http://www.google.com

Problem

I have ssh'd into my raspberry pi which uses Raspian OS (like Debian). I am trying to launch the default web browser from the terminal but I'm running into problems. I have looked at this post on launching web browsers from terminal. I have tried the `xdg-open` and the `sensible-browser` commands however they seem to just display the desired webpage's contents within the terminal. So no actual web browser is launching in the raspberry pi (which is what I want). My default web browser is Midori. So am I using these terminal commands incorrectly, or am I misunderstanding what they are meant to do? To be clear, I want to actually launch the web browser in the dekstop environment using a terminal command. Thanks!

Original source