The X server is usually started at boot time either via /etc/inittab or other initialisation script(s).
If not started automatically it can be started via the command line using either 'xinit' or it's front-end 'startx'.
X Window System initialiser - /usr/bin/xinit
Start the X Window System server and a first client program on systems that cannot start X directly from /etc/init or in environments that use multiple window systems. When this first client exits, xinit will kill the X server and then terminate.
xinit [[client] options ...]
[-- [server] [display] options ...]
If no specific client program is given on the command line, 'xinit' will look for a file in the user's home directory called .xinitrc to run as a shell script to start up client programs.
If no such file exists, 'xinit' will use the following as a default:
xterm -geometry +1+1 -n login -display :0
If no specific server program is given on the command line, 'xinit' will look for a file in the user's home directory called *.xserverrc~ to run as a shell script to start up the server.
If no such file exists, xinit will use the following as a default:
Some Man page examples:
Start up a server named X and run the user's '.xinitrc' if it exists else start an xterm
Start a specific type of server on an alternate display
xinit -- /usr/local/bin/Xqdss :1
Start up a server named X and append the given arguments to the default 'xterm' command - ignores '.xinitrc'
$ xinit -geometry =80x65+10+10 -fn 8x13 -j -fg white -bg navy
Use the command '.Xsun -l -c' to start the server and append the arguments '-e widgets' to the default 'xterm' command
$ xinit -e widgets -- ./Xsun -l -c
Start a server named X on display 1 with the arguments '-a 2 -t 5'
$ xinit /usr/ucb/rsh fasthost cpupig -display ws:1 -- :1 -a 2 -t 5
It will then start a remote shell on the machine 'fasthost' in which it will run the command 'cpupig', telling it to display back on the local workstation.
Determine X server to run - /etc/X11/xinit/xserverrc
# To determine which X server to run xinit looks first for $(HOME)/.xserverrc,
# failing that /etc/X11/xinit/xserverrc
# $Id: xserverrc 189 2005-06-11 00:04:27Z branden $
exec /usr/bin/X11/X -nolisten tcp
Man page's example - ˜/.xinitrc
# When xinit/startx is called it determines which client to run by looking for
# $(HOME)/.xintrc, if this is not found it uses /etc/X11/xinit/xinitrc.
# xinitrc sources /etc/X11/Xsession
xrdb -load $HOME/.Xresources
xsetroot -solid gray &
xclock -g 50x50-0+0 -bw 0 &
xload -g 50x50-50+0 -bw 0 &
xterm -g 80x24+0+0 &
xterm -g 80x24+0-0 &
# Starts a clock, several terminals and leaves the window manager
# running as the 'last' application.
Ubuntu default (system wide) - /etc/X11/xinit/xinitrc
# $Xorg: xinitrc.cpp,v 1.3 2000/08/17 19:54:30 cpqbld Exp $
# global xinitrc file, used by all X sessions started by xinit (startx)
# invoke global X session script