Startx
lastmod 2020-09-06created 2020-09-054 edits
The startx script is a front end to xinit(1).
Security notes
By default Xorg is configured to act as an X server. This can be dangerous since X uses unencrypted TCP connections and listens for X clients.
How to use
Now try running startx to start the xserver. startx is a script that runs an xsession. Through this script, the xserver starts and graphical programs are launched on top of it. It decides which programs to run using the following procedure:
- If a .xinitrc file exists in your home directory, it runs the commands listed in that file.
- If that file does not exist, it reads the value of the
XSESSIONvariable from/etc/env.d/90xsessionand runs the corresponding session. TheXSESSIONvalues are in/etc/X11/Sessions/. To set a system-wide default session, run the following command:
This creates the 90xsession file and sets the default X session to Xfce. Don't forget to run env-update after changing the 90xsession setting.
If you have not installed a window manager yet, you will only see a black screen. Since that may also mean something is wrong, it is a good idea to emerge twm and xterm purely for testing X.
Once the two programs are installed, run startx again. A few xterm windows should appear, which easily confirms that the xserver is working properly.
A session (the program to start) can be given as an argument to startx:
You can also pass X11 server options after two dashes: