1, Shell 1.1, Introduction
The shell is meant to mean "shell", a "shell" program that surrounds the Linux kernel, and all the tasks that the user completes on the operating system are implemented through the interaction of the shell with the Linux system kernel.
In addition to the default Bourne again Shell (bash) under Linux, there are many other shells, such as C Shell (csh), Korn Shell (ksh), Bourne shell (SH), and Tenex C Shell (tcsh). Each version of the shell functions basically the same, and now the Linux system distribution is generally used bash as the default shell.
In order to speed up the operation of the command and to more effectively customize the shell, the shell defines some built-in commands, which are generally called built-in commands, such as CD, PWD, exit, and Echo commands, which are built-in commands that are part of Bash's commands.
In addition to the built-in commands, there are many executable files on the Linux system that can also be executed as shell commands. In fact, many of the commands on Linux are not Shell's built-in commands, such as LS is an executable file, stored in the/bin/ls. These commands are different from the shell built-in commands, and are only loaded by the system when they are called.
The shell performs the command interpretation in the following way: After the user has entered a command at the command line, the shell program first detects if it is a built-in command, and if it does, interprets the command as a system call through an interpreter inside the shell and submits it to the kernel for execution, if not the shell built-in command. Then the shell will follow the path given by the user or according to the configuration information of the system environment variable to find the corresponding command on the hard disk, then call it into memory, and then interpret it as a system invocation, commit to the kernel execution.
1.2. Shell Basic syntax
1.2.1, Shell command general format
After the user logs on to the system, the shell command line starts. The shell follows a certain syntax format to parse and interpret the commands entered by the user and pass them to the system kernel. The general format of the shell command is:
----- arguments: Command parameter # on the command line, the option is a code that contains one or more letters, mainly used to change the way the command is executed, typically there is a "-" in front of the optionto distinguish the parameters
According to Custom, we generally refer to the string with the above format as the command line. The command line is the basic unit of the dialog between the user and the shell.
Wildcard characters in the 1.2.2, shell
Wildcards are primarily intended to facilitate user-friendly descriptions of files or directories, such as when a user simply needs a file that ends with ". Sh", which can be easily implemented using wildcards. Each version of the shell has wildcards, which are special characters that users can use in the command-line parameters to match the file name or pathname.
- "*": matches any one or more characters
- “?” : Matches any single character
- "[]": matches any single character that is contained within square brackets
For example:
ls *. SH ls ?. SH ls [xyz]. SH # matches files with file name x.sh or y.sh or z.sh
Linux Learning----Basics (shell, command, and VI use)