How To Set X11 Display Variable In Linux

When it comes to configuring your Linux environment, one topic that often confuses beginners is the X11 Display variable. This tutorial will guide you on how to set the X11 Display variable in Linux.

What is the X11 Display Variable?

The X11 Display variable, also known as the DISPLAY environment variable, determines the user interface’s connection to the X server. In simple terms, it tells your system where to display the GUI when you run a graphical application.

How to Set the X11 Display Variable

Setting the X11 Display variable is relatively straightforward. Here are the steps:

Step 1: Open Terminal

Firstly, open your terminal. This can be done by searching for “Terminal” in your system’s main menu or by using the shortcut Ctrl+Alt+T.

Step 2: Use the export Command

Next, use the export command to set the DISPLAY variable. The general syntax is: export DISPLAY=:0

This is how it can be done:

    export DISPLAY=:0.0

In this example, “:0.0” is the default display variable for the first screen attached to your PC. If you have multiple screens, you can change the number accordingly.

Step 3: Verification

You can verify if the DISPLAY variable has been set correctly by using the echo command:

    echo $DISPLAY

This command should return the value you just set (“:0.0” in our example).


Setting the X11 Display variable in Linux may seem a bit daunting at first, but with a little practice, it becomes easy. Remember, this environment variable is crucial for connecting the user interface with the X server, especially when running graphical applications. So, take the time to understand it and learn how to set it correctly.