$ sudo apt install xvfb
$ man Xvfb NAME Xvfb - virtual framebuffer X server for X Version 11 SYNOPSIS Xvfb [ option ] ... OPTIONS -screen screennum WxHxD This option creates screen "screennum" and sets its width, height, and depth to W, H, and D respectively. By default, only screen 0 exists and has the dimensions 1280x1024x8. -fbdir framebuffer-directory This option specifies the directory in which the memory mapped files containing the framebuffer memory should be created. This option only exists on machines that have the mmap and msync system calls.
$ mkdir ~/xvfb.dir/ $ Xvfb :99 -screen 0 1280x1024x8 -fbdir ~/xvfb.dir/ & #Run xclock at display 99 $ xclock -display :99 & #Display the image. $ xwud -in xvfb.dir/Xvfb_screen0
$ Xvfb :98 & $ xclock -display :98 & $ xwd -out xfvbtest.xwd -root -display :98 $ xwud -in xfvbtest.xwd
#kill the process that has an open connection with Xvfb $ ps -ef | grep xclock mtitek 4068 2394 0 20:58 pts/8 00:00:00 xclock -display :98 $ kill -9 4068 #clean-up the temp files $ ls -alrt /tmp/ -r--r--r-- 1 mtitek mtitek 11 Nov 28 20:58 .X98-lock $ rm -rf /tmp/.X98-lock #kill the Xvfb process $ ps -ef | grep Xvfb mtitek 4057 2394 0 20:58 pts/8 00:00:00 Xvfb :98 $ kill -9 4057