What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
DISPLAY tells an X11 application where to send its graphical output. A value such as :0 normally means display 0 on the local host, while node1:0 identifies display 0 on node1. For SSH sessions, you usually should not set the variable manually: ssh -X or ssh -Y creates a temporary forwarding endpoint and sets DISPLAY for you.
This distinction matters. Setting DISPLAY=:0 can fix a local shell problem, but it commonly breaks SSH forwarding, fails under sudo, and does not give a container access to an X server by itself.
What the DISPLAY variable means
The standard form is host:display[.screen].
Examples:
| Value | Meaning |
|---|---|
| :0 | Display 0 on the local host |
| :0.0 | Screen 0 of local display 0 |
| node1:0 | Display 0 on host node1 |
| localhost:10.0 | Usually an SSH X11-forwarding proxy display |
The omitted hostname in :0 does not mean “the first display everywhere.” It means display 0 on the host relevant to the process. If the process is running on a remote server, :0 refers to that server, not automatically to your laptop.
Check the current DISPLAY value
Before changing anything, inspect the value inherited by your current shell:
#1 Best Overall
printf ‘%s\n’ “$DISPLAY”
You can also use:
echo “$DISPLAY”
An empty result means that DISPLAY is unset. It does not tell you which X server is available, nor does it prove that the machine is running a graphical session.
Environment variables are inherited by commands started from the shell. Therefore, an exported value affects applications launched from that shell and its descendants, but not unrelated existing processes.
Set DISPLAY for a local graphical session
If an X11 application is running on the same Linux desktop as the shell, set the variable in that shell:
export DISPLAY=:0
Confirm the setting:
printf ‘%s\n’ “$DISPLAY”
Then launch the application:
xclock
Replace xclock with the program you need to run. The setting remains in effect for commands launched from the current shell. Opening another terminal will not necessarily inherit it, because that terminal may be started by a desktop session with a different environment.
Free tools Windows power users keep installed
One-click scans. No signup required.
Set it for one command only
To avoid changing the shell environment, put the assignment before the command:
DISPLAY=:0 xclock
This is useful for testing two display values or launching one program against a particular display.
Do not use DISPLAY=:0 as the generic SSH fix
Suppose you connect to a server with:
ssh user@remote-host
If you then run:
export DISPLAY=:0
the application looks for display 0 on remote-host. It does not automatically send the window to the computer from which you connected. This fails when the remote machine has no X server listening on display 0, or when the X server rejects the connection because authentication is missing.
For a remote graphical application that should appear on your local computer, use SSH X11 forwarding instead.
Use SSH X11 forwarding
-
Make sure the computer on which you are sitting has a usable X server. Linux desktop sessions commonly provide one directly or through Xwayland. A Wayland session by itself does not make an arbitrary manual value such as DISPLAY=:0 correct.
-
Connect with untrusted X11 forwarding: ssh -X user@remote-host
-
Check the value SSH supplied: echo “$DISPLAY”
-
Launch the remote X11 application without overwriting DISPLAY: xclock
A forwarded value commonly resembles localhost:10.0. This is a proxy display on the remote machine. SSH forwards the X11 traffic back to the local X server, where the window is rendered. The number may differ from 10 if another forwarded display is already in use.
When to use ssh -Y
Some older or less compatible applications do not work with untrusted forwarding. In that situation, try trusted forwarding:
ssh -Y user@remote-host
-Y gives the remote application broader access to the local X session than -X. Use it only when you trust the remote system and the programs you run there.
Enable X11 forwarding on the SSH server
If SSH reports that the forwarding request failed, inspect the effective server configuration on the remote host:
sudo sshd -T | grep -i ‘^x11forwarding’
The result must be x11forwarding yes.
The setting is normally configured in /etc/ssh/sshd_config. Open the file with an administrator editor and add or change X11Forwarding yes.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Validate the configuration before reloading SSH:
sudo sshd -t
If validation succeeds, reload the service:
sudo systemctl reload sshd
On distributions where the unit is named ssh, use sudo systemctl reload ssh.
Reconnect after changing the setting. An existing SSH session does not retroactively receive X11 forwarding configuration.
Other SSH settings that affect forwarding
On current Ubuntu documentation, relevant defaults include:
| Setting | Typical default | Purpose |
|---|---|---|
| X11Forwarding | no | Permits or denies X11 forwarding |
| X11UseLocalhost | yes | Binds the forwarding proxy to loopback and normally produces a localhost display value |
| X11DisplayOffset | 10 | Starting display number for forwarded sessions |
| XAuthLocation | /usr/bin/xauth | Location of the X authentication utility |
Normal SSH X11 forwarding requires a usable xauth installation on the server. If it is missing or the configured path is wrong, SSH may accept the login while applications fail with authentication or “cannot open display” errors. Older X11 clients can sometimes require X11UseLocalhost no, but changing that reduces the default loopback restriction and should be done only for a specific compatibility reason.
Fix common errors
| Error | Likely cause | What to check |
|---|---|---|
| X11 forwarding request failed | The connection did not request forwarding, or the SSH server rejected it | Reconnect with ssh -X or ssh -Y; check X11Forwarding yes |
| Can’t open display or Cannot open display | Unset or incorrect DISPLAY, unavailable X server, or failed authorization | Print DISPLAY; confirm a client X server exists; check X11 authentication |
| X11 connection rejected because of wrong authentication | The Xauthority cookie does not match the display, often after changing users or entering a container | Check the user, DISPLAY, and Xauthority credentials together |
Do not assume that reloading or restarting SSH fixes every error. A daemon reload applies server configuration; it cannot create an X server on the client, repair a wrong manually assigned display, or recreate credentials lost by sudo or a container.
Rank #4
Using DISPLAY with sudo
Running a graphical program as another user changes the authentication problem. The new process needs both the correct DISPLAY value and the matching Xauthority cookie.
This command is invalid: sudo export DISPLAY=:0.
export is a shell builtin, not a standalone executable that sudo can run. More importantly, passing only DISPLAY would not pass the corresponding X authentication credentials.
For a local desktop session, preserve or explicitly pass the required environment only when you understand the security consequences, and arrange access to the appropriate Xauthority data. For an SSH-forwarded session, do not replace SSH’s value with :0. Changing users can also discard the forwarded credentials, so test the exact command and user combination rather than assuming the parent shell’s access carries over.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →DISPLAY in containers
An X11 application inside a container normally needs all of the following:
- An X11 socket exposed from the host, commonly under /tmp/.X11-unix.
- A DISPLAY value matching the host endpoint.
- Valid Xauthority credentials for the user running the application.
Setting this inside the container is not enough: export DISPLAY=:0. That assignment neither creates an X server nor authorizes the container to use the host’s server. The exact socket, credential, user-ID, and security setup depends on the container runtime and whether the host session is local or SSH-forwarded.
Why a desktop menu may not see your setting
Applications launched from a terminal inherit that terminal’s environment. Applications launched by a desktop menu, display manager, Xsession, or systemd user service may be initialized through a different path.
Consequently, adding export DISPLAY=:0 to ~/.bashrc may affect interactive Bash terminals but not an application started from the desktop. KDE applications launched from menus, KRunner, or XDG autostart can run as systemd user-session services; those may require an environment configuration appropriate to the desktop or systemd user-session mechanism instead of .bashrc.
Recommended Free Tools
Best Value
- New
- Mint Condition
- Dispatch same day for order received before 12 noon
- Guaranteed packaging
- No quibbles returns
There is no universal Linux menu such as “Settings → Display → DISPLAY variable.” The correct configuration point depends on whether the program is launched by a shell, desktop session, SSH, container runtime, or service manager.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.A practical decision guide
| Situation | Correct first step |
|---|---|
| Local X11 application from a terminal | Check DISPLAY; if appropriate, use export DISPLAY=:0 |
| One local command needs a different display | Use DISPLAY=:0 application-name |
| Remote application over SSH | Connect with ssh -X or, when trusted, ssh -Y |
| SSH forwarding request rejected | Check server-side X11Forwarding, xauth, and reconnect |
| Application launched from a desktop menu | Configure the desktop/session environment rather than assuming .bashrc is read |
| Application inside a container | Provide the X socket, matching DISPLAY, and authorization credentials |
FAQ
What should DISPLAY be on Linux?
There is no single correct value for every Linux system. A local X session is often :0 or :0.0. An SSH-forwarded session commonly uses a value such as localhost:10.0. Check the current value with printf ‘%s\n’ “$DISPLAY” and do not replace an SSH-generated value.
Why does DISPLAY=:0 fail over SSH?
In an SSH shell, :0 refers to display 0 on the remote host. It does not automatically refer to your local computer. Use ssh -X user@remote-host, then let SSH set DISPLAY.
How do I permanently set DISPLAY?
Avoid a universal permanent setting unless you know which session owns the X server. ~/.bashrc affects some interactive Bash shells, but desktop applications and systemd user services can use different environment mechanisms. A hard-coded :0 can also overwrite valid SSH-forwarding values.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Is X11Forwarding yes enough for SSH GUI applications?
No. The client must request forwarding with -X or -Y, the client computer needs a usable X server, and the remote server needs functioning X11 authentication, normally through xauth.
Can I use sudo export DISPLAY=:0?
No. export is a shell builtin, so that is invalid usage. Also, a root process needs matching Xauthority credentials as well as the correct DISPLAY value. Passing the variable alone does not solve authentication.
The Bottom Line
Use export DISPLAY=:0 only when you have identified a local display 0 and need to set it for the current shell. For a single command, use DISPLAY=:0 application-name. For remote GUI programs, connect with ssh -X or ssh -Y and preserve the dynamically assigned value. If forwarding fails, check the SSH server configuration, xauth, the client’s X server, and X11 credentials separately.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minute

