Contact us

Print

xinit and startx

Exercise 6


xinit and startx


startx is actually a script that is a front end to the “xinit” program. The xinit program is used to start the X Window System server from the command line. It gets its control information from it’s control file - “.xinitrc”
It is often used by users that want to start X from a command line environment with some customizations (e.g. startup a certain application or a certain window manager etc).
Unlike display managers (xdm, gdm etc), xinit does not manage user sessions

1. After the system reboots, log in as root.

2. Kill the X server if it is currently running by taking the system down to runlevel 3. Type:


[root@localhost root]# init 3


3. While in root’s home directory, check if you currently have a “.xinitrc” file. Type:


[root@localhost root]# ls -l .xinitrc

ls: .xinitrc: No such file or directory


The sample output above means that the file does not currently exist. If the file exists delete it.

4. Create a custom .xinitrc file that will start a xterm client as well as the Tab Window Manager (twm)
window manager whenever you start X from the command line. Type:


[root@localhost root]# echo "xterm &" > ~/.xinitrc && echo "twm" >> ~/.xinitrc


5. Use the cat command to view the contents of the file you created above. Type:


[root@localhost root]# cat .xinitrc

xterm &
twm

If the text in your .xinitrc file is not similar to the one above, use a text editor to correct it.


6. You will use the “xinit” command to start the “X server”. While logged in locally at console (tty1).
Type:


[root@localhost root]# xinit


7. You will be thrown into a graphical user interface (GUI) with a pseudo terminal (xterm) already
running. The window manager running the “Tab Window Manager” (twm) that was specified in the
“.xinitrc” file. The GUI is similar to the figure below:


8. You can use the virtual console (xterm) to run commands just like you would from the
main console (but now you also have some basic GUI capabilities).

For example try running the graphical calculator – “xcalc”. Type:


[root@localhost root]# xcalc


You have to click on the window that pops up to make it usable.

9. Exit the xcalc program by pressing <CTRL> <C> in the xterm window.

10. Experiment by trying to run other programs and commands that you learned from
previous labs from the virtual terminal. Which commands did you try?



11. Kill the current X server and repeat step 6 above but this time use the “startx” command
instead of the “xinit” command. Simultaneously press the CTRL ALT BACK SPACE keys
to kill the Xserver.

Reboot the system when done.


Created by: system. Last Modification: Wednesday 26 of November, 2008 20:07:33 EST by wale.

...