Xterm on raspberry-pi to Xming on windows

Elena picture Elena · Jun 18, 2014 · Viewed 7.2k times · Source

I have a raspberry-pi. I have it set up so I can ssh into it with putty from my windows machine. I have codeblocks installed on the raspberry-pi. I would like to be able to open and display the codeblocks ide on my windows machine from the pi. I have xterm(-v 278) installed on my pi and Xming installed on my windows machine.

On my windows machine open Xlauch to start Xming I leave the default values but I disable access control. Then on my windows machine I open putty to ssh into my pi, with X forwarding enabled for this session. Once logged in on the pi I type

$ export DISPLAY="<windows_machine_ip>:0.0

$ xterm DISPLAY

than I get the message xterm: No absolute path found for shell: DISPLAY

I am really confused why I am getting this message. Does anyone know a fix or can explain what I am doing wrong. Thanks in advance.

Answer

harmic picture harmic · Jun 19, 2014

You do not need to put the argument DISPLAY after xterm like that. It is enough to have the environment variable DISPLAY set and exported (as you have in your first command).

The synopsis of xterm is:

xterm [-toolkitoption ...] [-option ...] [shell]

So, when you type this:

xterm DISPLAY

it is interpreting the word DISPLAY as the name of the shell you want to use - thus the error message No absolute path found for shell: DISPLAY.

In short, all you had to type was this:

$ export DISPLAY="<windows_machine_ip>:0.0
$ xterm &

I recommend putting the '&' on the end, as that starts xterm in the background and returns your original shell so you can enter more commands if desired.

Since you are using PuTTY, an even easier way is to use it's built in X11 forwarding.

Configure Putty for X11 Forwarding

Under Connection->SSH->X11, tick 'enable X11 forwarding' before you start your session. After this, as soon as the connection is open, just type xterm &, or any other X command.

Note that when using SSH X11 Forwarding, you do not need to set the DISPLAY variable. It will automatically be set on login, to a value such as localhost:10.0. This means that the sshd daemon is pretending to be an X server with display #10, whereas in reality it is forwarding all connections through to your local PC where they reach the real X server.