Running X11 programs from the terminal
If you are running a command from a terminal prompt that launches a program that uses X11 and you are getting an error that says something like: Failed to open X-Display, you need to set your DISPLAY variable in the shell. To do this, you can type the following on the command line prior to running the program:
and it will then work. This specific command is for the bash shell, if you are using a different shell, the format may vary slightly. But however you set variable in your shell, set the DISPLAY variable to the value shown above.
If you don't want to run this on the command line every time, you can add this line to your profile file (the name of which will vary by the shell you are using) found in your home directory. For bash, the file is called .bash_profile.
export DISPLAY=:0.0
and it will then work. This specific command is for the bash shell, if you are using a different shell, the format may vary slightly. But however you set variable in your shell, set the DISPLAY variable to the value shown above.
If you don't want to run this on the command line every time, you can add this line to your profile file (the name of which will vary by the shell you are using) found in your home directory. For bash, the file is called .bash_profile.
| Rating: | no ratings, 0 total Votes |
| Categories: | UNIX linux Mac terminal errors |
| Added: | on Jan 28, 2008 at 8:04 am |
| Added By: | an anonymous user |

