3

I need to launch a GUI program from the command line on a machine I have SSH'd into. I don't need to interact with it or see the window, just have it running. When I try and launch it I get:

ubuntu@ip-35-163-23223429-46:~/photoscan-pro$ ./photoscan.sh 
photoscan: cannot connect to X server

Is there anything I do? I'm on Ubuntu 12.04. Thanks!

1
  • The problem is with the script and not with the command you are executing.So what you are doing is the correct way. Jan 29, 2014 at 11:12

1 Answer 1

1

Inside the script, before the application is launched, add this line:

export DISPLAY=:0.0

This tells the program that it has to run in the DISPLAY with ID :0.0 instead of the terminal where is being called,which (as far as I know) reffers to the TTY7.

In other words, sends it to the graphic environment. You can also use it locally, launching a program in the desktop from a virtual tty. I use it for instance when compiz crashes and there are no menus or icons to restart it:

export DISPLAY=:0.0 && compiz --replace
3
  • Thank you so much. It worked! What does this actually do? Jan 29, 2014 at 12:16
  • This tells the program that it has to run in the DISPLAY with ID :0.0 instead of the terminal where is being called,which (as far as I know) reffers to the TTY7. In other words, sends it to the graphic environment. You can also use it locally, launching a program in the desktop from a virtual tty. I use it for instance when compiz crashes and there are no menus or icons to restart it: export DISPLAY=:0.0 && compiz --replace Jan 29, 2014 at 12:20
  • @darent, you should edit that explanation into the answer. Feb 5, 2014 at 17:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .