Study Notes-a preliminary understanding of shell

Source: Internet
Author: User
Study Notes-a preliminary understanding of shell-general Linux technology-Linux programming and kernel information. The following is a detailed description. Linux has two interfaces: a gui and a character interface (also known as the command line interface). The command line interface is a shell interface that is often described in Linux. So what is shell? The shell interpretation in the third edition of Linux baodian (People's post and telecommunications Publishing House) is a program used to explain and process commands. Based on this, I understand that shell is equivalent to a command in DOS or Windows, that is, a command interpreter. Anyone familiar with DOS or Windows knows that input a command (such as the dir command) in the DOS or Windows cmd window. This command is executed through the command.com program. The shell mentioned in Linux should be similar to this command, but the name is different, but the function is the same. In other words, the shell Interface we call is actually the interface for executing commands by manually inputting a command like DOS.

Although shell is similar to DOS, its position is far greater than DOS's position in Windows. For those who are used to using Windows, even some senior users who call themselves masters or experts usually work in the GUI, DOS is usually used only in some special places, such as batch processing and partitioning disks. Shell is completely different, because "most Linux experts think shell is more powerful than GUI", "many very competent users seldom use the GUI, they use shell to do most of their work. <人民邮电出版社> ). Therefore, learning shell is unavoidable to become a user proficient in Linux.

There is only one type of command interpreter in DOS, except that different versions have more and more powerful functions. In other words, the command functions and numbers in DOS6.22 are more powerful than those in DOS3.1, while the command functions and quantities in DOS7.0 are more powerful than those in DOS6.22, today, the DOS window in Windows has reached a higher level in terms of command functions and quantity (but it is undeniable that, some of the work we have done in the Windows graphic interface is not competent by DOS ).

Different from DOS, there are more than one command interpreter in Linux, or more than one shell. The most common one is bash shell (bash for short ), in addition, there are ksh, tcsh, csh, and sh. With different shells, the commands we can execute and the functions we can implement will also be different. In other words, if you change to a shell, the commands in it may be different from those in the previous shell (we cannot say they are completely different, because some of these shells are compatible with each other ). I think this happens because of the two reasons: Linux open source and Linux born out of UNIX. (If you are interested, you can learn about the development history of Linux and UNIX, there are many interesting stories ). It is precisely because of the open source of Linux that we can easily obtain its core source code. On this basis, as long as he is willing and capable, you can develop your own shell. This situation may be difficult for beginners (such as me) to find out which shell they want to learn, or after I learn a shell, I cannot understand the shell written by a private expert. What should I do?

In fact, after learning about Linux for a period of time, we will understand that we do not need to worry about it. Although anyone who wishes to develop a set of shell that only belongs to him, there are not many of them, and even if such a shell exists, but at present, we have already formed the mainstream. The shell that can mature applications and be accepted by everyone is just the one mentioned above. In addition, many types of shells are usually included in a Linux release. As long as we are willing to, we can switch or choose among these types of shells at any time. Therefore, for most beginners, we only need to master a shell. Currently, the default shell in Linux is bash. I think we only need to learn this one. Of course, if you want to, you can also learn more shell.

By the way, some colleagues around me often say "I wrote a shell". In fact, the shell they mentioned here refers to a shell script, it is totally different from the shell we mentioned above. I don't know if there are such people among other linux users, but in fact shell and shell scripts are completely different concepts. Therefore, do not think that it is easy to develop a shell. At least I understand Linux at present. This seems very difficult.

BTW: shell scripts combine many commands into a file. When executing this file, each command in the file is executed in sequence. This is similar to the batch processing in DOS or Windows.
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.