Introduction to Linux shell kernel commands

Source: Internet
Author: User
Tags linux shell commands

There are many things worth learning about the shell kernel. Here we mainly introduce the Linux shell kernel, including the shell kernel. As the operating system shell, the Linux system shell provides users with the interface to use the operating system. It is a general term for the command language, command Interpretation Program, and programming language.

What is Linux shell kernel?

Shell is the interface program between the user and the Linux kernel. If you think of the Linux shell kernel as the center of a sphere, the Linux shell kernel is centered around the outer kernel. When commands are passed from shell or other programs to Linux, the kernel will respond accordingly.

The Linux shell kernel is a command language interpreter. It has its own built-in shell command set, and shell can also be called by other applications in the system. The commands entered by the user at the prompt are explained by shell and then passed to the Linux core.

Some commands, such as changing the working directory command cd, are included in the shell. There are also some commands, such as Copy command cp and move command rm, which are separate programs in a directory in the file system. For users, there is no need to worry about whether a command is built inside shell or a separate program.

The Linux shell kernel first checks whether the command is an internal command. If it is not an application, the application here can be a Linux utility, such as ls and rm, it can also be a purchased commercial program, such as xv, or a free software, such as emacs ). Then shell searches for these application search paths in the search path, which is a list of directories where executable programs can be found ). If the entered command is not an internal command and the executable file is not found in the path, an error message is displayed. If the command is successfully found, the internal command or application will be decomposed into system calls and passed to the Linux kernel.
 
Another important feature of the Linux shell kernel is that it is an interpreted programming language. The shell programming language supports most program elements that can be seen in advanced languages, such as functions, variables, arrays, and program control structures. The shell programming language is easy to learn. Any command that can be typed in a prompt can be put into an executable shell program.

When a common user successfully logs on, the system executes a program called shell. The shell process provides a command line prompt. As the default TurboLinux system, the default shell is BASH), and "#" is used as the prompt for common users and Super User root.

Once a Linux shell kernel prompt is displayed, you can enter the command name and parameters required by the command. Shell will execute these commands. If a command takes a long time to run, or a large amount of output is generated on the screen, press ctrl + c on the keyboard to interrupt it before it ends normally, abort its execution ).

When you are about to end the Login Dialog process, you can press ctrl + d to run the logout command, exit command, or file Terminator EOF.

Let's take an internship on how the Linux shell kernel works.

$ Make work

Make: *** No rule to make target 'work'. Stop.

$ Note: make is the name of a command in the system, followed by the command parameters. After receiving this command, shell will execute it. In this example, the system returns information and stops executing the command because the input command parameters are incorrect.

In this example, the Linux shell kernel looks for a program named make and runs it with the work parameter. Make is a program that is often used to compile large programs. It is compiled with parameters as the goal. In "make work", the goal of make compilation is work. Because make cannot find the target named "work", it will give an error message indicating that the operation failed, and the user will return to the system prompt.

In addition, if the shell cannot find the program named by the command name after you type the command line, an error message is displayed. For example, if you type:

$ Myprog

Bash: myprog: command not found

$ You can see that the user gets an error message that does not find the command. After the user knocks on the wrong command, the system generally gives such an error message.

  1. Comprehensive Analysis and Discussion of Linux Shell Programming
  2. Brief Introduction to the Collection programming language of Linux shell commands
  3. Change the output of linux shell
  4. How to use Linux Shell Variables
  5. Linux Shell metacharacters

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.