In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
How to analyze the switching relationship between terminal interface and graphical interface in Linux? aiming at this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.
In fact, it is easy to switch between the command interface and the graphical interface, just a few commands, but to thoroughly understand the design architecture behind this requires a lot of concepts. Here is an introduction to X Window in the Ubuntu 18.10 operating system. The content is to understand the basic concepts of X Window on your machine, understand display and virtual console, connect X Server remotely, understand the startup process of DisplayManager and X Window desktop environment, and run nested X Server.
What is X Window
X Window is not a specific form interface, X Window is essentially a hierarchical architecture, which is divided into Server and Client. The X Server is responsible for the display of the graphical interface and the input of the user, while the Client program needs to connect to the X Server, then request the X Server to draw the graphical interface and accept the user's input from the X Server. On desktop systems, X Server and Client programs are often installed on the same machine, and there is basically no sense of layering in daily use. Just like one of our computers, X Server and Client are on the same computer.
Since X Window is a hierarchical architecture, it is clear that X Server and Client can also run on different machines, run programs on one machine, and display a graphical interface on the other.
A lot of people are a little confused when they get here. We also have a Server-Client hierarchical structure when we write the website. Is there a difference? Of course there is.
The concepts of Server and Client in X Window are the opposite of the concept of "Server/Client" that we usually come into contact with. Many people who are familiar with the principle of Internet will get both concepts wrong the first time they come into contact with X Window. In Server/Client in Internet, Server is responsible for handling the relevant business and then returning the results to the Client client, but X Window is just the opposite. It is handled by Client and displayed by Server.
For example, I have two computers running Ubuntu 18.10 Desktop on one local machine and CentOS 7 (character-only interface) on another remote machine. If it is the Server/Client architecture in Internet, Ubuntu is Client and CentOS is Server.
But in X Window, Server happens to be the Ubuntu,X Server in front of me running on Ubuntu. I can run GVim in CentOS, but the window appears in Ubuntu, where GVim is a Client program that runs on a remote machine, and its window appears locally.
Second, understand display and virtual console
Many articles about X Window on the Internet are about letting the system enter the character interface and then manually launching an X Server. In fact, this is completely unnecessary, because you can run multiple X Server on the same machine, just make the display of each X Server different. So what on earth is display?
In fact, display is a computer equipped with a set of input and output devices, a computer can have multiple input and output devices, of course, there can be only one.
In X Window, you can specify a screen through hostname:display_number.screen_number. It can be understood that a computer can have multiple display, and a display can have multiple screens. Therefore, display is equivalent to a set of input and output devices equipped with a computer. In general, a computer is equipped with only a set of keyboard and mouse and a monitor. In special cases, it can be equipped with multiple monitors.
Now the problem is that my computer has only one keyboard and mouse and one monitor, that is, only one display, so how can I run multiple X Server? That's because there are advanced features such as virtual consoles in Linux. Just press Ctrl+Alt+F1, Ctrl+Alt+F2, … at the same time. , Ctrl+Alt+F7, you can switch between different virtual consoles. It is equivalent to equipping this computer with seven different monitors.
Note: by default, Linux provides 6 Terminal to allow users to log in, switching from Ctrl+Alt+F1 to F 6. Moreover, the system will name the six terminal interfaces after tty1, tty2, tty3, tty4, tty5 and tty6. In addition, Linux has a default X-window desktop. Using Ctrl+Alt+F7, I can switch to the graphical desktop to log in. Why use tty to name it?
Tty: a general term for terminal equipment.
The word tty comes from Teletypes, or teletypewriters, which originally refers to a teletypewriter, something that uses a printer keyboard to read and send messages through a serial line, but it was later replaced by a keyboard and display, so now it's more appropriate to call a terminal. Terminal is a kind of character device, which has many types, and tty is usually used to refer to various types of terminal devices. Linux by default
Tty1~6 is the text console and tty7 is the X Window graphic display manager.
However, the graphical desktop and user terminals may vary from Linux to distribution.
For example, in Ubuntu 18.10, virtual consoles 3 to 6 run tty, that is, character interfaces, that is, Ctrl+Alt+F3 to F6 display tty3, tty4, tty5, tty6, virtual console 2 runs Xorg, and virtual console 1 runs a graphical interface.
III. Mutual transformation between Terminal and X Window.
The previous switching back and forth using Ctrl+Alt+Fn is only a formal transition. Each is running, but the one shown is different. In fact, Terminal and X Window have different operating levels in Linux. Linux has a total of 7 run level. Under different operating levels, the system has different states. They are:
0: stop (remember not to set initdefault to 0, as this will prevent Linux from starting)
1: single-user mode, just like the security mode under Win9X.
2: multi-user, but no NFS.
3: full multi-user mode, standard run level.
4: generally not, you can use it to do something in some special cases.
5:X11, that is, into the X-Window system.
6: restart (remember not to set initdefault to 6, as this will cause Linux to restart again and again).
The default run level for Terminal is 3, and the default run level for X Window is 5. Now if I am interrupting, enter the following command:
Init 3
Then it kills X Window, so there is no X Window, only Terminal, and if I want to re-enter X Window, I need to log in at Terminal and execute
Startx
Reopen the X Window.
This is the answer to the question on how to analyze the switching relationship between the terminal interface and the graphical interface in Linux. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.