[Linux exploration journey] Part 2 Lesson 1: Terminal terminal, playing a good show, lesson 1 Terminal

Source: Internet
Author: User
Tags old windows

[Linux exploration journey] Part 2 Lesson 1: Terminal terminal, playing a good show, lesson 1 Terminal


Introduction

1. Part 2 Lesson 1:Terminal

2. Lesson 2: command line, the world at your fingertips


Terminal


With the end of the first part, we entered the second part (small Editor you seem to be nonsense ...).


Maybe the first part is a bit biased in theory, and it is difficult to describe how to install the Ubuntu System of the Linux release version. Therefore, it is normal to make a little bit of "Youth dementia" after the small series is suffering.


But I want to assure you that starting from this part, the movie is officially staged!


After the first part of the baptism, we learned about the history and many concepts of Linux, how to install Linux, Linux desktop environment and graphical interface.


Maybe you are not very comfortable with Linux systems, especially those who have used Windows systems.


However, it is undeniable that the graphic interface of the Linux system we have seen is not much different from that of Windows. The browser also opens it with a click, and the folder is also visualized, so it is not too difficult to install software.


However, the uniqueness of Linux will be gradually revealed from this course. If you are an old Windows user, you will find that this is a brand new world. In addition, you may not have such experience before. Maybe you may say that you have written something in Dos. Isn't that good.


What we will introduce soon is Terminal (Terminal in English). It can be said that its world is infinitely broad. Almost no one dares to say that they have learned all the terminal things, and there will always be new things waiting for us to discover.


The so-called "one into the terminal deep like the sea, from then on the sister is a passer-by ".


Joke, learn Linux technology well, get familiar with terminal command line, and marry Bai fumei. It is not difficult to go to the peak of your life.


Why is there a terminal?


Before formally setting yourself in the terminal ocean, you should first learn some "life-saving knowledge" to avoid "drowning ".


After all, it's still a long time. We don't want to "watch you, but we can't do anything about it. Let's let you disappear at the end of the terminal ...".



Is the general impression of a terminal. The background behind this terminal is really a sea of ocean...


We should first consider the following issues:


Why do we need to invent a terminal instead of using a graphical interface at the beginning?

After all, the mouse + graphic interface is more intuitive.

Is it just for the purpose of installing high-end professionals that they deliberately make such a complicated situation, so that people feel that information technology can only be done by some insiders?

Why didn't I remove the terminal? This is outdated.


It is a good problem. Let's answer them one by one.


Q: Why do we need to invent a terminal instead of using a graphical interface at the beginning?

A: We have already discussed the first lesson of the first part. The answer is: we have no choice. When the terminal was just invented, it was around the beginning of the 1970 s. It was an age where even black and white screens were luxurious, at that time, the computer's computing power was far inferior to a calculator in the hands of my sister-in-law next door. Yes, it is so difficult. Today, even more common graphic interfaces and mouse operations require high processing capabilities. At that time, in the dark old society, Chen really couldn't do it. Therefore, the terminal became the only way to manipulate the computer at that time.


Q: after all, the mouse + graphic interface is more intuitive.

A: Yes. I totally agree with you. The terminal is indeed not as intuitive as the real graphic interface. When we first started learning information technology, the graphic interface was certainly easier to use. In addition, the graphic interfaces (Gnome, Unity, KDE, and so on) in Linux are more and more easy to use than Windows graphic interfaces. Terminals are indeed a threshold for beginners.


Q: Is it just for the purpose of installing high-end professionals that they intentionally make such a complex task? Is it true that information technology can only be done by some insiders?

A: In the beginning, the commands in the terminal are really uncomfortable. Then you may say, "Isn't this pile of meaningless letter combinations just to show that not many people can use terminals ?" (The implication is that only high-end programmers can use terminals ). However, this is not the case at all. This is all well thought out by information technology experts:

  1. The command in the terminal is shorter and concise: This is to save time. For example, there is a commonly used command pwd in the terminal to display the current directory. If it is more intuitive, I may have to write this command: inwhichdirectoryamirightnow (in which directory is my current directory ), after writing it hundreds of times, you will know how humane the experts who invented this pwd command are.


Q: Why didn't I remove the terminal? This is outdated.

A: Since the graphic interface was invented, why haven't we deleted the old terminal technology? Many may have this question. However, it may take much time to learn terminal operations than the graphic interface. However, once we have mastered how to use commands in the terminal, it can often be faster, higher, and more powerful than the graphic interface. In addition, some operations can only be completed by the terminal, and it is boring to turn to the graphic interface.


For example:

There are various file types in a directory: text files, images, audios, and videos. If you want to know the number of JPEG images. Isn't it easy on the Gui?


However, in the terminal, you can run the following command:


ls -l | grep jpg | wc -l


The displayed result is as follows:

108


How is it? In just a few seconds, we will get the answer we want. If it is a graphical interface, can it be so fast?


We can also store the number of statistics in a text file:


ls -l | grep jpg | wc -l > jpeg_nb.txt


We can even use the following command: First count the number, save it to the cmd_nb.txt file, and then send the file to a friend by email.


Therefore, terminal command lines are never outdated.


You will find that most of the Linux terminal commands are the same as those of Unix, with the same name and usage. This does not mean that the source code of Linux commands is copied or copied from Unix, but the functions are the same, the source code of these Linux commands is written by geeks from all over the world from the GNU project.


After that, the GNU open-source project merged with the Linux operating system kernel (written by Linus Torvalds) and became a complete operating system called GNU/Linux. But later, people simply referred to it as Linux. Of course, these are detailed in the first part of the first lesson.


So what are the benefits?

Terminal commands have almost never changed since the 20th century. Therefore, today, a very old Unix user can also be "healthy" in the Linux operating system. Because the commands are basically the same. In addition, this will happen in many years. Therefore, although the terminal command line may take you some time to get started, it can be used for a lifetime. This is cool ~ At the age of 70, I went programming to earn extra money.


At the beginning of the next lesson, we will officially learn terminal command lines, which are almost the same in Unix and Linux. In addition, it is the same in many other operating systems based on the Unix design philosophy. After all, Unix is the ancestor.


Therefore, you can also use the various terminal commands we will learn on Apple's Mac OS X System Based on Unix systems.


If you are a user of Apple Mac OS X, you can open a Unix terminal to experience the operations on the terminal:


  1. Go to-> utility (you can also use the shortcut key: cmd + shift + U ):



  2. Click the terminal icon to open a terminal.


If you think this is too troublesome, you can also put the terminal in the Dock on the desktop to facilitate the next startup:




Real terminals are a bit daunting


So the question is: how can we open the terminal in our current Ubuntu Desktop Environment (Gnome, Unity or KDE?


There are many methods. In Linux, we can often achieve the same goal through several different methods.


First, we will introduce a method that is generally not used: Enter the real terminal.


What is "real?

It can be said that there is no graphic interface, it is a dark box, Black Bottom white words, and then you can only use the keyboard to input.


We can quickly enter the real terminal through a combination of shortcut keys.


However, before starting, please first learn how to exit from these real terminals and return to our Ubuntu Desktop. Otherwise, you may be confused...


Assume that you are currently on the Ubuntu Desktop, for example, in the Unity desktop.




We will use a combination of shortcut keys to enter the terminal called tty (also known as the Console (in English )).


What is tty?


In Linux, TTY may be the most confusing term related to the terminal.


TTY is an abbreviation of TeleTYpe. Teletypes, or teletypewriters, originally referred to as a telex typewriter and used to read and send information through a printer keyboard on a serial line. They are not very different from the old telegraph machine.


Then, when the computer can only run in batch (The punched card reader was the only way to load and run the program ), the telex typewriter is the only "real-time" input/output device that can be used. In the end, the telex typewriter was replaced by the keyboard and display terminal.


Console)

In Linux, a computer monitor is usually called a Console ). It simulates a Linux terminal (TERM = Linux), and some special files of the device are associated with it: tty0, tty1, tty2, and so on.

When you log on to the console, tty0 is used. With Ctrl + Alt + [F1-F6] keys, we can switch to tty1, tty3 and so on. Tty1-tty6 is called virtual terminal, and tty0 is an alias of the current virtual terminal, the information generated by the system will be sent to the terminal (also called the console terminal ). Therefore, no matter which virtual terminal is being used, the system information will be sent to the console terminal. /Dev/console refers to the console, which is a device that interacts with the operating system. The system directly outputs some information to the console. You can log on to the console only in single-user mode.


The definition may be abstract, but it does not need to be understood too much.


The shortcut keys for logging on to TTY are:


  1. Ctrl + Alt + F1: terminal 1 (tty1)

  2. Ctrl + Alt + F2: terminal 2 (tty2)

  3. Ctrl + Alt + F3: terminal 3 (tty3)

  4. Ctrl + Alt + F4: terminal 4 (tty4)

  5. Ctrl + Alt + F5: terminal 5 (tty5)

  6. Ctrl + Alt + F6: terminal 6 (tty6)

  7. Ctrl + Alt + F7: Return to the graphic interface (Thank God ~)


Therefore, a total of six consoles are available.


Before you start the test, remember how to exit the real dark terminal. Oh, press Ctrl + Alt + F7.


You can select a terminal to enter. For example, if you want to enter terminal 1, you can use the shortcut key combination: Ctrl + Alt + F1.


Your screen may flash a few times. Don't be afraid. Then you enter the real terminal, such:




"One night before liberation, there was a huge film ". Before using this terminal, You need to log on first.


Enter the user name you registered when installing Ubuntu, and press Enter:


Enter your password again (when you enter the password, the screen will not show any content you entered, or even the star number), and press Enter. You can use tty1.


You can also access other terminals in a similar way (a total of six terminals exist at the same time, tty1 ~ Tty6 ).


Now, after the demo is complete, we can exit the terminal and press Ctrl + Alt + F7.


Then we went back to our GUI desktop.


The real terminal is still very useful, although it is a little scary for beginners. However, you should know that many Linux-based servers do not have a graphical interface, and all the operations are carried out in such a large black box.


And sometimes, when a problem occurs on our computer, we need to solve the problem in the real terminal.


Graphical Terminal


After a little excitement of the "real" terminal interface, let's take a look at the terminal mode we usually use. Even the crazy Linux users prefer terminal in graphic mode.


There are many reasons:


  1. Graphical terminals are more user-friendly. When using terminals, you can also use other graphical applications, such as chat software and chat with friends.

  2. The screen resolution is larger, so we can display more content in the terminal.

  3. We can customize the appearance of the terminal, or even change the background for it.

  4. We can also copy and paste text with the mouse (yes, in the terminal of the graphic mode, the mouse can also be used.


Therefore, we will continue to use graphical terminal in subsequent courses.


How can I open a terminal in the graphic mode?


  1. If you are on the Unity desktop, you can call up the system search box. Ubuntu 14.04 has a function key called the Super key, which is actually the Win function key in Windows. That is, the Microsoft logo button on most keyboards, which is called the Super key in Ubuntu. Pressing this key is the same as clicking the Ubuntu logo button in the upper left corner of the desktop. You can see that the Super key function is actually a search box that can search for various software, materials, and everything you need on your computer and network. Then enter "terminal" in the search box, and you can see that the terminal is located:



    You can lock "Terminal" to the taskbar or put it on the desktop to become a shortcut, so that you do not need to start it every time through the Super key.

  2. You can use the shortcut key to call up the terminal: Ctrl + Alt + T. Of course, you can also modify the shortcut combination of the terminal in the shortcut mode, instead of using the system default one.




Summary


  1. The terminal is a wonderful thing. In the beginning, its low appearance and difficulty may make us discouraged. However, after getting started, you will find that the terminal command line is so powerful that it feels like flying. In addition, the terminal can help us do some work that the graphic interface cannot do, and the complexity is simplified.

  2. Although we can use the shortcut key (Ctrl + Alt + F1 ~ F6) to enter tty1 ~ Tty6 is the six real full-screen terminals, but we usually use the most commonly used graphical terminal.



Part 2 Lesson 2 advance notice


Today's class is here. Come on!

In the next lesson, we will learn:Command Line, the world at all

Copyright Disclaimer: This article is an original article by the blogger. You must specify the source for reprinting. Otherwise, you will be held legally liable.

Related Article

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.