As a programmer in the magical world of Linux, the Linux shell Command is a magic command. However, sometimes there are still some problems with the use. Next we will look at how to better use the Linux shell Command.
Shell itself is a program written in C language. It serves as a bridge between the user's use of Linux Shell commands. Shell is both a command language and a programming language. As a command language, it interactively interprets and executes user-input commands. As a programming language, it defines various variables and parameters, it also provides many control structures that are available in advanced languages, including loops and branches. Although it is not part of the core of Linux, it calls most of the core functions of the system to execute programs, create files, and coordinate the running of various programs in parallel. Therefore, shell is the most important utility for users. It is the key to make good use of the Linux system by thoroughly understanding and mastering the features of shell. It can be said that the proficiency of shell reflects the user's proficiency in Linux.
1. What is a Linux shell Command?
After a user logs on to Linux, the system initialization program init runs a shell program for each user. So what is shell? To be exact, shell is a command line interpreter that provides users with an interface system-level program that sends requests to the Linux kernel to run the program, you can use shell to start, suspend, stop, or even write some programs.
When you use the Linux Shell Command, you can use the command to complete the required work. A command is a basic unit of dialog between a user and a shell. It consists of multiple characters and ends with a line break. Shell explains the commands entered by the user, just as command.com in DOS does. The difference is that in DOS, command.com has only one, in Linux, there are several popular shells, each of which has its own merits. Generally, bash is used as the default shell in Linux.
2. Several popular Linux shell commands
Currently, popular shell types include ash, bash, ksh, csh, and zsh. You can use the following command to view your own shell types:
- #echo $SHELL
$ SHELL is an environment variable that records the shell type used by the user. You can run the following command:
- #shell-name
To another shell. Here, shell-name is the name of the shell you want to use, such as ash. This command starts another shell for the user. This shell is called a lower-level shell or a sub-shell after the shell is first logged on. Run the following command:
- $exit
You can exit this sub-Linux shell Command.
The reason for using different shells is that they all have their own characteristics. The following is a brief introduction:
1. ash
Ash shell is compiled by kenth almsource. A small shell that occupies the least system resources in Linux contains only 24 internal commands, which makes it inconvenient to use.
2. bash
Bash is the default shell used by Linux shell commands. It is jointly completed by Brian Fox and Chet Ramey. It is the abbreviation of Bourne Again Shell. There are 40 internal commands. Linux uses it as the default shell because it has the following features:
(1) You can use a function similar to doskey under DOS, and use the direction keys to view and quickly enter and modify commands.
(2) The command starting with a string is automatically provided by searching for matching.
(3) It includes its own help function. You only need to enter help at the prompt to get the help.
3. ksh
Ksh is short for the Korn shell. It is written by Eric Gisin and contains 42 Internal commands. The biggest advantage of this shell is that it is almost completely compatible with the commercial release ksh, so that you can try the performance of the commercial version without spending money to buy the commercial version.
4. csh
Csh is a large Linux kernel. It is compiled by a total of 47 authors represented by William Joy and contains 52 Internal commands. This shell actually points to a shell like/bin/tcsh, that is, csh is actually tcsh.
5. zch
Zch is one of the largest shell commands in Linux. It is completed by Paul Falstad and contains 84 Internal commands. For general purposes, there is no need to install such a shell.