LinuxCommandLibrary

xpra

Run graphical applications remotely, persistently, and detachably

SYNOPSIS

xpra [OPTIONS] COMMAND [ARGUMENTS]

Common Commands:
xpra start [DISPLAY] [OPTIONS] --COMMAND [ARGS]
xpra attach [PROTOCOL:]HOST[:DISPLAY] [OPTIONS]
xpra stop [DISPLAY | UUID | PID | all]
xpra info [DISPLAY | UUID | PID | all]
xpra list
xpra shadow DISPLAY [OPTIONS]

PARAMETERS

--version
    Show program's version number and exit.

-h, --help
    Show a help message for the command and exit.

--display=DISPLAY
    Specify the X display to use for the client or server. E.g., :10 for server, :0 for client.

--bind-tcp=[HOST]:PORT
    Add a TCP socket listener for incoming client connections on the server. Host defaults to 0.0.0.0 (all interfaces).

--bind-ssl=[HOST]:PORT
    Add an SSL socket listener for secure client connections on the server.

--password-file=FILE
    Specify a file containing the password for client authentication. Supported by TCP and SSL connections.

--ssh=COMMAND
    Specify an alternative ssh command to use for establishing the connection.

--daemon=yes|no
    Detach xpra from the terminal and run it in the background (server mode only). Default is yes.

--start-child=COMMAND
    Start the specified command as a child process of the xpra server. Used to launch applications or desktops.

--desktop=yes|no
    Run a full desktop environment instead of forwarding individual applications. Default is yes for start command.

--encoding=ENCODING
    Specify the preferred screen encoding (e.g., webp, h264, vp8, png, jpeg, rgb). Negotiated with client.

--quality=LEVEL
    Set the encoding quality level (0-100). Higher is better quality, larger bandwidth.

--speed=LEVEL
    Set the encoding speed level (0-100). Higher is faster encoding, potentially lower quality.

--pulseaudio=yes|no
    Enable or disable Pulseaudio sound forwarding.

--clipboard-sync=yes|no
    Enable or disable clipboard synchronization between client and server.

--file-transfer=yes|no
    Enable or disable file transfer capabilities.

--web-enabled=yes|no
    Enable or disable the integrated web server for HTML5 client access (server only).

--opengl=yes|no
    Enable or disable OpenGL acceleration for rendering (client side).

--log-level=LEVEL
    Set the logging level (e.g., info, warn, error, debug).

--mmap-enabled=yes|no
    Enable or disable memory-mapped pixel data transfers for local connections, improving performance.

DESCRIPTION

Xpra is an open-source tool that allows you to run graphical applications and even full desktops on a remote server, and then display them on your local machine. It acts as a 'screen for X', enabling you to disconnect from a remote session and reconnect later from the same or a different client, without losing the state of your running applications.

Unlike traditional X forwarding (ssh -X), xpra provides better performance over high-latency networks by intelligent screen updates and various encoding options (like WebP, H.264, VP8). It also supports features like sound forwarding (Pulseaudio), clipboard synchronization, file transfer, printing, and webcam forwarding.

Xpra transparently handles network disruptions, allowing for seamless re-attachment to sessions. It can run in various modes, including forwarding individual applications, full desktops, or even shadowing an existing X server. Its robust design makes it an excellent choice for remote development, server administration, or accessing graphically intensive applications from a thin client.

CAVEATS

For optimal performance, xpra benefits from low-latency connections, though it is designed to work well over high-latency links. Firewall rules must allow connections on specified TCP/SSL ports. Running an xpra server exposed to the internet without proper authentication (e.g., --password-file, SSH) is a significant security risk. Some advanced desktop environments or applications might have specific rendering requirements that could impact performance or visual fidelity, though xpra generally handles a wide range of applications well. Client-side X server dependencies are required for display.

CONNECTION MODES

Xpra supports several ways to connect:

  • SSH: The most common and recommended method, tunneling xpra over an encrypted SSH connection (ssh://user@host/display).
  • TCP/SSL: Direct TCP or SSL connections to an xpra server listening on a specific port (tcp://host:port/display, ssl://host:port/display).
  • Web (HTML5): The server can expose a WebSocket interface (ws://host:port/ or wss://host:port/) allowing clients to connect directly from a web browser without installing xpra.
  • Local Socket: For clients connecting on the same machine as the server, it uses a local Unix domain socket or named pipe for maximum performance.

APPLICATION VS. DESKTOP MODE

Xpra can forward either:

  • Individual Applications: By specifying a command (e.g., xpra start :10 --firefox), only that application's windows are forwarded. This is ideal for specific tasks.
  • Full Desktop Sessions: By omitting the command or specifying a desktop environment (e.g., xpra start :10 --start-child=xfce4-session), xpra creates a full virtual desktop, allowing users to interact with a complete remote desktop environment.

PERFORMANCE OPTIMIZATION

Xpra uses adaptive encoding and compression to optimize performance. It can dynamically switch between various image and video encodings (e.g., WebP, H.264, VP8 for video-like content; PNG, JPEG for static images) based on network conditions and screen content. Users can fine-tune quality, speed, and compression levels using command-line options to balance visual fidelity and network bandwidth usage.

HISTORY

Xpra originated from the desire to create a persistent remote X session similar to screen or tmux for terminal sessions, but for graphical applications. It was first released around 2008-2009, with a core focus on dealing with network disconnections and providing a responsive user experience over varied network conditions. Over the years, it has evolved significantly, incorporating advanced video encodings, sound forwarding, clipboard synchronization, and other modern remote desktop features.

It's often seen as a more robust and performant alternative to traditional ssh -X forwarding, especially for graphical applications that generate a lot of screen updates or for users on unstable networks. Its ability to suspend and resume sessions makes it a powerful tool for maintaining work continuity on remote servers.

SEE ALSO

ssh(1), vncserver(1), screen(1), tmux(1), X(7)

Copied to clipboard