What is a shell? What does bash do? What's the matter?

Source: Internet
Author: User

What is a shell?  What does bash do? What's the matter?


The shell is the interface between you (the user) and Linux (or, more accurately, you and the Linux kernel). Each command you enter at the prompt is interpreted by the shell before being passed to the Linux kernel.


The shell is a command language interpreter (Command-language interpreter). Has its own built-in shell command set. In addition, the shell can be called by other valid Linux utilities and applications (utilities and application programs) in the system.


Whenever you type a command, it is explained by the Linux shell. Some commands, such as printing the current working Directory command (PWD), are included inside Linux bash (like dos internal commands). Other commands, such as the Copy command (CP) and the Move command (RM), are separate programs that exist in a directory on the file system.


For the user, you don't know (or may not care) whether a command is built inside the shell or a separate program. The shell first checks whether the command is an internal command, and then checks whether it is an application, where the application can be a utility for Linux itself, such as LS and RM, or a commercially available program such as XV, or public domain Software), just like Ghostview. The shell then tries to find these applications in the search path ($PATH). The search path is a list of directories where executable programs can be found. If the command you typed is not an internal command and the executable file is not found in the path, an error message will be displayed. If the command is successfully found, the Shell's internal command or application is decomposed into a system call and passed to the Linux kernel.


Another important feature of the shell is that it is itself an interpreted programming language, and the Shell programming language supports the vast majority of program-controlled structures that can be seen in high-level languages, such as loops, functions, variables, and arrays. The Shell programming language is easy to learn, and once mastered it becomes your powerful tool. Any command that can be typed at the prompt can also be placed in an executable shell, which means that the shell language can simply repeat a task.


bash is a shell, with a friendly interface, more easy to operate, more convenient to users, command completion function: Usually when you enter a command under bash (or any other shell), you don't have to lose the command to the shell to determine the command you want to enter.  bash  Another way to make command input easier is to use wildcards in commands. Bash supports three wildcard characters:

* matches any character and any number of characters

Match any single character

"..." matches any single character enclosed in parentheses


bash also supports command history,  bash Save the command text you entered earlier in a history list. When you log in with your account the history list will be initialized according to a history file , , This file is usually in your user directory ($HOME). The user at the command prompt can flip through the history command by the up and down arrows. Bash also supports input, output redirection, piping, and other simple and easy to use.

   

      Good, Li Xiao said so much, but also a summary of personal understanding, hope to help beginners!






This article is from the "Li Yunli TEST-2015" blog, be sure to keep this source http://liyunli0226.blog.51cto.com/10006245/1750812

What is a shell? What does bash do? What's the matter?

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.