Xinit start X Window System

Source: Internet
Author: User
Xinit start X Window System

There are two main methods to start X: one is Display Manager, such as xdm, TPD, and KDM. The other method is to Log On Through xinit. This method is suitable for logging on to the character interface. . We often use the startx command used to log on to X by passing parameters to xini T to start X, that is, the final start of X is xinit. . Startx is just a bash script. The following is an analysis of xinit. Process of initializing X:
First, let's take a look at the usage of the xinit command:
Xinit [[client] Options] [-- [server] [display] Options]
It can be seen that xinit initializes X through two layers, that is, X client Program And X server programs. [Client] and [server ] Is called the X client program and the X server program respectively. They represent the specific path of the program, which must be // or .
By default, when we run the xinit command without any parameters in CLI , Xinit will search for the. xinitrc file in the directory and execute it as X client. That is to say, you can run it when setting it to X. X client program. For specific settings, see later. According to $ home/ Whether or not xinitrc is available. xinit may have different running conditions.
1. If $ home/. xinitrc exists, it is equivalent to executing:
Xinit $ home/. xinitrc --/usr/bin/x
2. If $ home/. xinitrc does not exist, it is equivalent to executing:
Xinit xterm --/usr/bin/x
If $ home/. xinitrc does not exist or is not set correctly $ Home/. xinitrc won't Access Desktop Environment (desktop environment, such as gnome and KDE) Only one xterm and an "X" Mouse appear in front of us. . How can I access desktop environment? Let's analyze the running of the startx command. All right. By analyzing the content of the startx command file, we know that startx is mainly used to set the location of X client and X server, process related parameters, and finally hand over it to xinit for processing. . We can see that the position of X client in startx is to search for $ home/. xinitrc first. And then/etc/X11/xinit/xinitrc; set the location of X server to search for $ home/. xserverrc first And then/etc/X11/xinit/xserverrc.
It is equivalent to running the following command:
Xinit/etc/X11/xinit/xinitrc --/etc/X11/xinit/xserverrc
Further analysis:
Xinit/etc/X11/xsession --/usr/bin/X11/X-DPI 100
Xsessin is an important file. Why? ? Because whether you log on to X through Display Manager or through xinit (startx ) Log on to X and it will be executed. Xsession is a global file.
The xsession file contains the following content:
/Usr/bin/X-session-Manager/ * Start desktop environment */
/Usr/bin/x -Window-Manager/* Start Window Manager */
/Usr/bin/x -Terminal-emulator/* start terminal */
This is why we can use a startx command to directly access X. . If we want to enter gnome, we only need to set/usr/bin/x -Change the target file linked by session-manager to/usr. /Bin/gnome-session, and then put/usr/bin /Change the target file linked to X-window-manager /Usr/bin/metacity, set/usr/bin/x -Change the target file linked by terminal-emulator /Usr/bin/gnome-terminal.
After understanding the above content, we can modify $ home/ . Xinitrc, xinit is used to start desktop environment. The following uses the startup gnome as an example:
Create the. xinitrc file under $ home and add the following content:
Gnome-session &
Metacity/ * Except for running the last command on the foreground, all other commands should be run on the background */
After saving, you can start gnome by executing xinit on the terminal. Is it cool?
When xinit is used to start X, it should be noted that if the first running X client ends, xinit will automatically end X and return to CLI . The following is an example:
When $ home/. xinitrc does not exist, execute xinit metacity to display a movable xterm (none $ Home/. xinitrc, xinit starts xterm by default) Of course, there is also an X
Server. Close xterm will exit X because xterm is the first operation The X client of the row. If $ home/. xinitrc exists and contains the following content :
Xeyes &
Metacity &
Xterm
When xinit is executed, an xterm and an xeyes are displayed. , Close xterm will exit X, because other X clients (xeyes, metacity) are running in the background Xterm is the first X client running on the foreground.
Similarly, you can run the following command to start desktop environment:
Xinit TPD
Xinit/etc/X11/xsession

 

Exploring the principle and Startup Process of X Window System through http://linux.ccidnet.com/art/302/20060930/914543_1.html

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.