Linux DISPLAY variable with examples

Home > Search

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


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



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.

Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter in the box below so that we can be sure you are a human.