xvfb-run(1)
π xvfb-run(1) β like, the General Commands Manual entry, but make it make sense β¨
okay so bestie, buckle up π this one's from the General Commands Manual and it's genuinely iconic once you get what it's doing. no cap.
πΈ NAME πΈ
xvfb-run β runs whatever X client or command you hand it inside a virtual X server environment. that's the whole vibe. π¦
β¨ SYNOPSIS β¨
xvfb-run [ options ] command
π DESCRIPTION π
so xvfb-run is basically a wrapper for the Xvfb(1x) command, and what it does is take the whole "ugh i have to set up a virtual X server by hand" situation and make it a one-liner. slay. you use it to run commands β usually an X client, or a script that's got a whole list of clients in it β inside a virtual X server environment. π«Ά
here's the little routine it does, step by step:
- it sets up an X authority file (or, if you already gave it one with the options, it just uses yours),
- writes a cookie into it (peep
xauth(1x)for the lore on that), - then starts the
XvfbX server as a background process, - and it remembers the process ID of
Xvfbfor later, because it's gonna need it. π₯
then your specified command gets run, using the X display that corresponds to the Xvfb server it just started, plus the X authority file it created earlier. main character energy, honestly.
and when your command exits? it saves that status first, then goes into cleanup mode:
- the
Xvfbserver gets killed (using that process ID it stored earlier β iykyk), - the X authority cookie gets removed,
- and the authority file gets deleted (but only if you didn't specify one yourself to use).
then xvfb-run exits with the exit status of your command. periodt. π
π¨ important:xvfb-runrequires thexauthcommand to function. like, it genuinely cannot do its thing without it.
π OPTIONS π
-a,--auto-servernumβ tries to get a free server number, starting at 99, or at whatever you passed to--server-num. π-e file,--error-file=fileβ stores output fromxauthandXvfbin file. the default is/dev/null, so by default you're seeing none of that. π-f file,--auth-file=fileβ stores X authentication data in file. by default, a temporary directory calledxvfb-run.PIDgets created (wherePIDis the process ID ofxvfb-runitself) inside the directory named by the environment variableTMPDIRβ or/tmpif that variable is null or unset β and then thetempfile(1)command is used to create a file in that temp directory calledXauthority. π-h,--helpβ displays a usage message and exits. the classic. β¨-n servernumber,--server-num=servernumberβ uses servernumber as the server number (but, like, go look at the-a,--auto-servernumoption above first, bestie). the default is99. π-l,--listen-tcpβ enables TCP port listening in the X server. and honestly? for security reasons (aka avoiding denial-of-service attacks or exploits), TCP port listening is disabled by default. so only turn this on if you know what you're doing. π-p protocolname,--xauth-protocol=protocolnameβ uses protocolname as the X authority protocol. the default isβ.β, whichxauthinterprets as its own default protocol, which isMIT-MAGIC-COOKIE-1. cute. π¦-s arguments,--server-args=argumentsβ passes arguments to theXvfbserver. β οΈ be careful to quote any whitespace characters that show up inside the arguments, so they don't get treated as separators forxvfb-run's own arguments. also, heads up: specifyingβ-nolisten tcpβin arguments may override the function ofxvfb-run's own-l,--listen-tcpoption, and specifying the server number (likeβ:1β) may get ignored because of the way the X server parses its argument list. to do that second thing, use thexvfb-runoption-n servernumber,--server-num=servernumberinstead. the default isβ-screen 0 1280x1024x24β. π-w delay,--wait=delayβ ignored, for compatibility with earlier versions. yeah. it's just there. ngl it's giving vestigial. π
π ENVIRONMENT π
COLUMNSβ indicates the width of the terminal device in character cells. this value is used for formatting diagnostic messages. if it's not set, the terminal gets queried usingstty(1)to figure out its width. and if that fails? a value ofβ80βis assumed. πTMPDIRβ specifies the directory in which to placexvfb-run's temporary directory for storage of the X authority file. only used if the-for--auth-fileoptions are not specified. πΈ
β OUTPUT FILES β
unless the -f or --auth-file options are specified, a temporary directory and a file within it get created (and, later, deleted) to store the X authority cookies used by the Xvfb server and the client(s) run under it. see tempfile(1). π
if -f or --auth-file are used, then the specified X authority file is only written to β it's not created or deleted (though xauth creates an authority file itself if you tell it to use one that doesn't already exist). π
also, an error file with a user-specified name gets created if the -e or --error-file options are specified; see above. β¨
π₯ EXIT STATUS π₯
xvfb-run uses its exit status as well as output to standard error to communicate diagnostics. and here's the important bit: the exit status of β1β is not used, and should be interpreted as failure of the specified command. π
0βxvfb-runonly uses this exit status if the-h,--helpoption is given. in all other situations, this may be interpreted as success of the specified command. π2β no command to run was specified. π3β thexauthcommand is not available. π¨4β the temporary directory that was going to be used already exists. and sincexvfb-runproduces a uniquely named directory, this may indicate an attempt by another process on the system to exploit a temporary file race condition. like, be suspicious. π5β a problem was encountered while cleaning up the temporary directory. π§Ή6β a problem was encountered while usinggetopt(1)to parse the command-line arguments. π΅βπ«
π EXAMPLES π
xvfb-run --auto-servernum --server-num=1 xlogo
runs the xlogo(1x) demonstration client inside the Xvfb X server on the first available server number greater than or equal to 1. β¨
xvfb-run --server-args="-screen 0 1024x768x24" ico -faces
runs the ico(1x) demonstration client (and passes it the -faces argument) inside the Xvfb X server, configured with a root window of 1024 by 768 pixels and a color depth of 24 bits. π¨
π«Ά little note, bestie: the demo X clients used in the examples above will not exit on their own, so you'll have to kill them before xvfb-run will exit. they're clingy like that. π
π BUGS π
see the Debian Bug Tracking System β¨https://bugs.debian.org/xvfbβ©. and if you wish to report a bug in xvfb-run, please use the reportbug(1) command. π
π AUTHOR π
xvfb-run was written by Branden Robinson and Jeff Licquia with sponsorship from Progeny Linux Systems. respect the OGs. π«‘
π¦ SEE ALSO π¦
Xvfb(1x), xauth(1x)
and that's the whole page, bestie π this one's courtesy of the Debian Project, dated 2004-11-12 β vintage but still eating, fr fr. go run something in a virtual X server, you've got this πβ¨
π¦ where this page comes from
- alpine 3.24: xvfb-run-doc 1.20.10.3-r2 Β· GPL-2.0-or-later
- debian bookworm: xvfb 2:21.1.7-3+deb12u12
- debian bookworm: xvfb 2:21.1.7-3+deb12u13
- Copyright 1998-2004 Branden Robinson <branden@debian.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms