brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: xvfb-run -a runs a graphical program on a server with no screen

Linux
~/tips/tip-xvfb-run-auto-servernum

xvfb-run -a your-program --some-flag

Give a graphical program a virtual display on a headless machine.

Some programs insist on a display, even when I only want a screenshot or a test run on a server. A virtual screen solves that.

xvfb-run starts a virtual X server, runs your command inside it and stops it afterwards:

xvfb-run -a your-program --some-flag

The -a (--auto-servernum) option picks a free server number, starting at 99. Without it, xvfb-run uses server number 99 (the default). To change the screen size, pass server arguments with -s; the default is -screen 0 1280x1024x24:

xvfb-run -a -s "-screen 0 1920x1080x24" your-program

A caveat: nothing is shown anywhere. The program draws into memory, so you need a screenshot tool or the program’s own output to see what happened. On Debian and Ubuntu the package is called xvfb.

Further reading: xvfb-run man page (Debian)

More Linux tips a2query -m rewrite renice -n 10 -p 4242 cat config.yml | xsel -ib dpkg --get-selections > packages.txt flatpak uninstall --unused All Linux tips (261) All topics

Link