How to open a visual desktop in shell

Sometimes, you may want to use shell to run some program without ssh, then you will need this skill.

Here I use Xvfb. Before starting, if you use python, then xvfbwrapper would be a good choice.

  1. Start a new visual desktop
    Xvfb :99 -screen 0 1280x960x16&

    Here you can also choose other number not “:99”, as long as no other program use that port. And don’t forget “&” at the end of the commend.

  2. Configure display environment
    export DISPLAY=:99

    Now you can run your program headlessly.

Written on April 19, 2018