LinuxCommandLibrary

xvfb

Run graphical applications without a display

SYNOPSIS

xvfb [options] [:displaynumber]

PARAMETERS

-displayfd fd
    Specifies a file descriptor to write the server's display number to.

-screen scrn WxHxD
    Defines a screen with specified width (W), height (H), and color depth (D) in bits.

-nolisten protocol
    Disables listening for connections on the specified protocol (e.g., tcp).

-once
    Exits the server after the first client disconnects.

-shmem
    Enables shared memory support (usually enabled by default).

-noreset
    Prevents resetting the server after the last client disconnects.

-help
    Displays a list of available options

[:displaynumber]
    Specifies the display number for the Xvfb server (e.g., :1). If omitted, the server will pick an available display number.

DESCRIPTION

Xvfb is a virtual framebuffer X11 server. Unlike real X11 servers, it performs all graphical operations in memory without requiring a connected monitor. This makes it ideal for running graphical applications in headless environments, such as servers or continuous integration systems, where a physical display is not available or needed. Applications running within the Xvfb environment believe they are connected to a standard X11 server and can perform standard graphical operations.

Xvfb provides a way to test graphical applications without impacting the user's current desktop environment. It's useful for tasks like automated testing of GUI applications, generating screenshots from command-line scripts, or running software that depends on X11 libraries but does not directly display anything on the screen. You will need to set the DISPLAY environment variable appropriately so that X11 clients can find the virtual display created by Xvfb. Note: This is a server, not a client; clients connect to the display number defined in DISPLAY variable.

CAVEATS

Xvfb does not provide hardware acceleration. Graphical performance is limited by the CPU. Consider using alternatives like Xephyr or Xdummy if you need hardware acceleration within a virtual X server. Ensure you properly manage the DISPLAY environment variable for applications to connect to the Xvfb instance.

EXAMPLE USAGE

To start an Xvfb server on display :99 with a screen resolution of 1280x1024 and 24-bit color depth, and then run `xeyes` you can use:
Xvfb :99 -screen 0 1280x1024x24 &
export DISPLAY=:99
xeyes

HISTORY

Xvfb was designed to allow execution of X11 applications in environments where a physical display is not present. It's become a crucial part of automated testing and server-side rendering workflows.

SEE ALSO

xauth(1), X(7), Xephyr(1)

Copied to clipboard