Skip to content

Instantly share code, notes, and snippets.

@lebedov
Created August 13, 2012 19:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save lebedov/3343600 to your computer and use it in GitHub Desktop.
Save lebedov/3343600 to your computer and use it in GitHub Desktop.
Using Xvfb to create a headless display
#!/bin/bash
# Demonstrates how to create a headless display using xvfb.
# Create the display:
Xvfb :100 -ac &
PID1=$!
export DISPLAY=:100.0
# Run the application that needs the display:
xterm &
PID2=$!
# Kill the application:
kill -9 $PID2
# Remove the display:
kill -9 $PID1
@mohamedelkony
Copy link

Hi what does
export DISPLAY=:100.0
do?
Thanks

@lebedov
Copy link
Author

lebedov commented Jan 11, 2023

Hi what does export DISPLAY=:100.0 do? Thanks

You need to set the DISPLAY variable to the identifier associated with the virtual display created by Xvfb so that subsequently executed X11 applications use it rather than the default display.

@mohamedelkony
Copy link

Thank you @lebedov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment