Linux Lake 01: A methodology for playing the Linux system (reproduced)

Source: Internet
Author: User

Http://www.blogjava.net/youxia/archive/2015/01/08/linux001.html

In the first half of 2014, I was writing the RCP series. Then, because of the preparation of graduate thesis and defense, so it stopped halfway. Later, I started to write the Linux lakes and rivers series in the main station of the blog Park. After more than half a year of efforts, the Linux lakes and rivers series has more than 10 articles. Here I will post the contents and forward them to my Java blog. As for the RCP series, I will continue to write, but wait for my heart to sink again.

Linus said "Just for fun", and I'm going to say "Just for tossing". Want to know how I toss Linux, please look at the following:

From this it can be seen that I am trying to "toss" the Linux system to install 5 different distributions on my computer. They are Ubuntu 14.04 Desktop, CentOS 5.10, CentOS 6.5, Fedora 20, and an Ubuntu 14.04 Server Edition. In all of the above systems, only Ubuntu 14.04 desktop and Fedora 20 opened the GUI, and several other systems use the character interface. The above is the case when I use SSH to connect remotely to another four systems in Ubuntu 14.04 Desktop Edition.

About character interfaces and graphical interfaces

Years ago, I used a Linux system that favored character interfaces. Install B artifact Ah, whether it is other people seem to look, they seem to be particularly tall on. Of course, the character interface is very comfortable to use, but only once. Why, that is because in 14 or 17 inches, resolution limited to the era of 1024x768, the use of character interface, font size, there is no glare of strong light, eyes looked very comfortable. However, since the LCD screen, high-split screen era after the advent of this feeling of comfort is gone. Why? The word is too small. For example, in my 21.5-inch 1920*1080 LCD display, the use of the pure character interface is not able to see, even if the framebuffer can not be turned into a beautiful font. On my monitor, you must use the Dejavu Sans Mono font from 15pt to 16pt, and the eyes look comfortable. Now on the network, there are still a lot of people ask how to set up Linux to automatically enter the character interface after startup problems, I would like to tell them: pull down, or use the graphical interface. For a server system that does not have a graphical interface, be honest with SSH remote connection.

In the graphical interface, the use of gnome-terminal can still simulate the full character interface, just press a F11 button full screen. You can even set a translucent background to look more windy. Such as:

The graphical interface of Fedora 20 is also good, for example, using Vim and Gvim in a graphical interface is refreshing:

Why are there so many different distributions?

It's all Linux, so why install so many distributions? That's because the system and the system are not the same. Different genres of distribution, the same genre of the distribution, the old system and the new system is not the same. Or the classic question mentioned above, "How to set Linux to automatically enter the character interface after startup" as an example. For this question, the textbook answer is to change the boot level in the/etc/inittab file to 3. However, I can be very responsible for saying: The textbook is out of date.

I first started to contact Linux from Red Hat Linux 9, when I was eating a Red Hat Linux cookbook every day. Obviously, this book is now an antique grade, because Red Hat later began to do Enterprise Linux, every two years a version, now has to Enterprise Linux 6, will be out of the 7th edition. In these systems I installed, CentOS is equivalent to Red Hat Enterprise Linux,fedora is a test site for Red Hat's new technology, so they are a genre, Fedora 20 is newer than CentOS 5, CentOS 6, Ubuntu is another genre, every six months a new version, I use the current version of the latest.

I think many of us are learning about Linux from Red Hat. Just like my home there are a few classic textbooks, such as (I have a corner of the bookcase photo):

For the classic question mentioned earlier, the textbook answer applies only to CentOS 5 and its previous versions, and the other systems have their own methods. I'll explain the methodology in detail later.

Methodology for tossing Linux systems

To be in the Linux lakes unimpeded, light on a few introductory books is far from enough, but also have to master the appropriate method. My methodology is as follows:

1. When using a command, it is best to know which package it belongs to;

2. Will find and install the package, install the package, to be able to find out where the files are installed;

3. To read the documentation of the software;

4. Really not, just look at the source code bar.

Using my methodology still has a certain Linux base (such as how to do user management, file management and so on, and understand what Linux is a kind of system such a basic philosophical problem), so textbooks still need to read so many. After the basic stage, toss Linux is actually tossing the Linux system under the various software, this time, mastering the correct methodology is particularly important.

Examples Show

Or take the classic question mentioned above as an example, how can we get the Linux system to automatically enter the character interface after booting? According to my methodology, we still have to start with software analysis. After the kernel of the Linux system is loaded, the first process to be executed is init, which is to enter the character interface or the graphical interface, which is of course Init's final call. Different systems, the 1th process started is called Init, but is this init equal to the other init? So, 1. We're going to find out which package this init belongs to. 2. The files where the package was found are installed in the file system, which contains which programs and which documents; 3. Read the documentation for this package (of course, it is necessary to use the search engine to do some homework first); 4. Just read the source code.

In the Red Hat genre system (CentOS, Fedora), the package manager of the software is rpm. Look at CentOS 5.10 First, using the which init command, you can find the full path of Init to/sbin/init, and then use the rpm-qf/sbin/init command, It can be found that the INIT program is in the same package as sysvinit, and finally, using the rpm-ql sysvinit command, you can see which programs are in this package, which documents and where they are located in the filesystem, such as:

and Ubuntu belongs to another genre. Its package manager is dpkg. In Ubuntu, first, using the which init command, you can find out that the full path to Init is/sbin/init, and then use the sudo dpkg-s/sbin/init command to find out which package for the INIT program is upstart Finally, using the sudo dpkg-l upstart command, you can see what programs are in this package, which documents and where they are located in the filesystem, such as:

Study CentOS 6.5 In the same way, and discover that its Init program also belongs to the upstart software package, such as:

What are the advantages that make the upstart package replace the traditional Sysvinit package? Obviously, with the above information, we on Google to upstart, sysvinit as a keyword search and how difficult. In addition, will there be more advanced software packages to replace upstart? Let's look at what Fedora 20 uses, such as:

The original Fedora 20 was systemd. Use the cat/etc/inittab command to display the contents of the Inittab file, from which you can see that the concept of runlevel has already disappeared. Thus, Inittab and runlevel are not the philosophy of Linux itself, but the definition of software level.

Find and install Packages

One of the great things about using Linux distributions like Ubuntu, CentOS, and Fedora is that they all have an official package repository that requires a single command to find and install the appropriate package from the repository. Ubuntu systems use the Apt-get or aptitude,red hat genre for systems that use Yum. For example, use aptitude to find packages in Ubuntu:

Use Yum to find packages in CentOS 5:

How to view software documentation

Linux is a treasure, which has voluminous of carefully written documents, life is not complete. To discover this treasure, there are two keys necessary, they are man and info. For example, if you want to learn bash programming, you can try entering the man bash to view the bash's documents, such as (after all the effects of gnome-terminal full screen, fully simulating the full-text interface without setting a translucent background):

For GNU software, it is often provided with an info format, which can be read by the info command. For example, to learn how grub is installed and configured, you can enter info grub to view its documentation, such as:

It needs to be mentioned that in Ubuntu, many software documents are packaged separately and can be searched via the Aptitude Search command, and the corresponding documentation package is installed via the Aptitude Install command. Some of the software's documentation may not be in the man or info format, but in HTML or PDF format, and you can find out where the files are installed in the file system by the methods mentioned earlier, and then use the appropriate reader to open the reading.

Read the source code

By looking for packages, all-powerful search engines and well-written documentation, we can basically solve most of the problems with Linux systems. In rare cases, you may need to read the source code.

Under the Ubuntu system, you can get the source code for a package by using the sudo apt-get source command. For example, to learn how Getty is written, want to see its code, use such as command:

In Ubuntu, the source code for the Linux kernel is a special case and it is packaged separately. You can use the following command to search the source code of the kernel:

Yum itself does not download the ability to install the source code package.

However, the Yumdownloader tool in the Yum-utils package allows people to download the source code package. The command is yumdownloader--source package-name. The downloaded source code package is the. src.rpm format. You can use the Rpm2cpio command and the cpio command to unpack a source code package if you want to read only the source code instead of recompiling the source code. As follows:


After the source code is downloaded and installed, if just read, use vim enough. In the "Linux Lakes" follow-up series, I will certainly have a blog about how to toss vim, so do not continue to wordy here.

Summarize:

Master the above methodology, when the difficulties encountered in Linux, even without books or other people's guidance, but also through their own efforts to find solutions to the problem. The commands mentioned earlier are as follows:

Ubuntu System:

which

Dpkg-s

Dpkg-l

Aptitude Search

Aptitude Install

Apt-get Source

Mans

Info

CentOS, Fedora System:

which

Rpm-qf

Rpm-ql

Yum List

Yum Install

Yumdownloader--source

Rpm2cpio

Cpio

Mans

Info

(Jingshan Ranger in 2014-05-27 started in the blog Park, 2015-01-08 finishing in Blogjava, reproduced please indicate the source. )

Linux Lake 01: A methodology for playing the Linux system (reproduced)

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.