Linux Fundamentals - Understanding the $DISPLAY variable

by
Jeremy Canfield |
Updated: March 13 2020
| Linux Fundamentals articles
The DISPLAY variable will contain 3 pieces of information:
- Hostname
- Sequence Number
- Screen Number
In this example, the hostname is localhost, the sequence number is 10, and the screen number is 0. The english version of this would be "screen 0 on display 10, on my computer."
[john.doe@server1 ~]# echo $DISPLAY
localhost:10.0
In this example, the sequence number is 0 and the screen number is 0. This is very command. This means "the first screen on your main display."
[john.doe@server1 ~]# echo $DISPLAY
localhost:0.0
Hostname
The hostname is the name of computer running the X server. When hostname is localhost, this means the local system is the X server.
Sequence number
The sequence number can vary based on the number of monitors connected to the computer.
Screen number
0 is the default screen number. A system can have numerous screens.
Did you find this article helpful?
If so, consider buying me a coffee over at