Linux Shell series (1) Shell introduction, linuxshell

Source: Internet
Author: User

Linux Shell series (1) Shell introduction, linuxshell

This is the first article in the Linux Shell series. For more shell tutorials, see the Linux Shell series tutorials.

To learn about linux, shell is essential. Today I will give you a brief introduction to the basic knowledge of shell.

Shell Introduction

Shell itself is a program written in C language and serves as a bridge for users to use Unix or Linux. Most of users' work needs to be done through Shell. You can be familiar with linux only by using shell.

It can be said that Shell is both a command language and a programming language.

As a command language, it can interactively interpret and execute user-input commands. As a programming language, it can define various variables and parameters, it also provides many control structures that are available in advanced languages, including loops and branches.

Although Shell is not part of the Unix/Linux kernel, 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 making good use of Unix/Linux systems by thoroughly understanding and mastering shell features.

It can be said that the proficiency of shell reflects the user's proficiency in Unix/Linux.

Shell has two methods to execute commands:

  • Interactive: Explain and execute a user's command. If you enter a command, Shell will explain and execute a command.
  • Batch: you can write a Shell Script in advance. There are many commands in the Script so that the Shell can finish executing these commands at a time without having to repeat the command one by one.

Shell scripts are similar to programming languages, and there are also variables and process control statements. However, Shell scripts are interpreted and executed without compilation, the Shell program reads and executes these commands from one line in the script, which is equivalent to a user hitting the Shell prompt to execute the command line in the script.

However, for beginners of Shell, do not use the root account to run Shell in common applications. As a common user, you can't damage the system either intentionally or unintentionally. But if it is root, it is different. If you press a few letters, it may lead to disastrous consequences.

Common Shell types

As mentioned above, Shell is a scripting language, so there must be an interpreter to execute these scripts.

Common Shell script interpreters in Unix/Linux include bash, sh, csh, and ksh. They are used to being called a Shell.

We often talk about the number of Shell types. In fact, it refers to the Shell script interpreter.

The following describes several common shells.

Bash

Bash is the default shell for Linux. This tutorial is based on bash. Bash is jointly completed by Brian Fox and Chet Ramey. It is short for the BourneAgain Shell and has a total of 40 internal commands.
Linux uses it as the default shell because it has the following features:

You can use a function similar to doskey under DOS to view and quickly enter and modify commands with the direction keys.

The command that starts with a string is automatically provided by searching for matching.

It includes its own help function. You only need to enter help at the prompt to get help.

Sh

Sh is developed by Steve Bourne and is short for the Bourne Shell. sh is the default shell of the Unix standard.

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.

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.

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.
Note: bash is the abbreviation of Bourne Again Shell, which is the default shell of linux standard. It is based on the Bourne shell and absorbs some features of C shell and Korn shell. Bash is fully compatible with sh. That is to say, scripts written with sh can be executed in bash without modification.

Summary

This article mainly introduces Shell functions and several common shell types, which will give you an overall impression of Shell. Next, the Linux Emy network will provide you with a series of detailed tutorials on Shell commands, hope to help you.

For more shell tutorials, see the Linux Shell series tutorials.

Fixed Link: linux Emy network-Linux Shell series tutorial (1) Shell Introduction

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.