linux的shell类型_Linux中有哪些不同类型的Shell?

linux的shell类型

Shells are an important part of any Linux user session. We are provided several different types of shells in Linux to accomplish tasks. Each shell has unique properties. Hence, there are many instances where one shell is better than the other for specific requirements.

Shell是任何Linux用户会话的重要组成部分。 在Linux中,我们提供了几种不同类型的Shell来完成任务。 每个外壳都有独特的属性。 因此,在许多情况下,对于特定要求,一个外壳比另一个外壳要好。

This makes it important for us to be aware about the different types of shells available in Linux. In this tutorial, we will discuss what is a shell and why is it important.

这对我们来说很重要,要了解Linux中可用的不同类型的Shell。 在本教程中,我们将讨论什么是外壳以及为什么它如此重要。

Further, we will explore different types of shells in Linux to understand their functions and properties.

此外,我们将探索Linux中不同类型的Shell,以了解它们的功能和属性。

什么是外壳,为什么我们需要它们? (What is a Shell, and Why do we need them?)

Whenever a user logs in to the system or opens a console window, the kernel runs a new shell instance. The kernel is the heart of any operating system.

每当用户登录系统或打开控制台窗口时,内核就会运行一个新的Shell实例。 内核是任何操作系统的心脏。

It is responsible for the control management, and execution of processes, and to ensure proper utilization of system resources.

它负责控制管理和流程执行,并确保正确利用系统资源。

A shell is a program that acts as an interface between a user and the kernel. It allows a user to give commands to the kernel and receive responses from it. Through a shell, we can execute programs and utilities on the kernel. Hence, at its core, a shell is a program used to execute other programs on our system.

Shell是充当用户和内核之间接口的程序。 它允许用户向内核发出命令并从内核接收响应。 通过外壳,我们可以在内核上执行程序和实用程序。 因此,外壳程序的核心是用于执行系统上其他程序的程序。

Being able to interact with the kernel makes shells a powerful tool. Without the ability to interact with the kernel, a user cannot access the utilities offered by their machine’s operating system.

能够与内核进行交互使Shell成为功能强大的工具。 没有与内核交互的能力,用户将无法访问其计算机操作系统提供的实用程序。

Let’s understand the major shells that are available for the Linux environment.

让我们了解可用于Linux环境的主要shell。

Linux中不同类型的Shell (Different Types of Shells in Linux)

If you now understand what a kernel is, what a shell is, and why a shell is so important for Linux systems, let’s move on to learning about the different types of shells that are available.

如果您现在了解什么是内核,什么是外壳以及为什么外壳对Linux系统如此重要,那么让我们继续学习可用的不同类型的外壳。

Each of these shells has properties that make them highly efficient for a specific type of use over other shells. So let us discuss the different types of shells in Linux along with their properties and features.

这些外壳中的每一个都具有使它们在特定类型的使用方面比其他外壳更高效的属性。 因此,让我们讨论Linux中不同类型的Shell及其属性和功能。

1. 伯恩壳 (sh) (1. The Bourne Shell (sh))

Developed at AT&T Bell Labs by Steve Bourne, the Bourne shell is regarded as the first UNIX shell ever. It is denoted as sh. It gained popularity due to its compact nature and high speeds of operation.

史蒂夫·伯恩(Steve Bourne)由AT&T贝尔实验室开发,伯恩(Bourne)外壳被认为是有史以来第一个UNIX外壳。 它表示为sh。 它因其紧凑的性质和高速的操作而广受欢迎。

This is what made it the default shell for Solaris OS. It is also used as the default shell for all Solaris system administration scripts. Start reading about shell scripting here.

这就是使其成为Solaris OS的默认外壳的原因。 它也用作所有Solaris系统管理脚本的缺省shell。 从这里开始阅读有关Shell脚本的内容

However, the Bourne shell has some major drawbacks.

但是,Bourne壳具有一些主要缺点。

  • It doesn’t have in-built functionality to handle logical and arithmetic operations.

    它没有内置功能来处理逻辑和算术运算。
  • Also, unlike most different types of shells in Linux, the Bourne shell cannot recall previously used commands.

    另外,与Linux中大多数不同类型的Shell不同,Bourne Shell无法调用以前使用的命令。
  • It also lacks comprehensive features to offer a proper interactive use.

    它还缺乏提供正确交互使用的综合功能。

The complete path-name for the Bourne shell is /bin/sh and /sbin/sh. By default, it uses the prompt # for the root user and $ for the non-root users.

Bourne shell的完整路径名是/ bin / sh和/ sbin / sh。 默认情况下,它对根用户使用提示符 ,对非根用户使用提示符$

2. GNU Bourne-Again Shell (bash) (2. The GNU Bourne-Again Shell (bash))

More popularly known as the Bash shell, the GNU Bourne-Again shell was designed to be compatible with the Bourne shell. It incorporates useful features from different types of shells in Linux such as Korn shell and C shell.

GNU Bourne-Again壳被更广泛地称为Bash壳,旨在与Bourne壳兼容。 它并入了Linux中不同类型的shell的有用功能,例如Korn shell和C shell。

It allows us to automatically recall previously used commands and edit them with help of arrow keys, unlike the Bourne shell.

与Bourne shell不同,它使我们能够自动调用以前使用的命令并借助箭头键进行编辑。

The complete path-name for the GNU Bourne-Again shell is /bin/bash. By default, it uses the prompt bash-VersionNumber# for the root user and bash-VersionNumber$ for the non-root users.

GNU Bourne-Again shell的完整路径名是/ bin / bash。 默认情况下,它对根用户使用提示符bash-VersionNumber# ,对非根用户使用提示bash -VersionNumber $

3. C Shell (csh) (3. The C Shell (csh))

The C shell was created at the University of California by Bill Joy. It is denoted as csh. It was developed to include useful programming features like in-built support for arithmetic operations and a syntax similar to the C programming language.

C shell是由Bill Joy在加利福尼亚大学创建的。 它表示为csh。 它被开发为包括有用的编程功能,例如对算术运算的内置支持以及类似于C编程语言的语法。

Further, it incorporated command history which was missing in different types of shells in Linux like the Bourne shell. Another prominent feature of a C shell is “aliases”.

此外,它还包含了命令历史记录,而在Linux中,像Bourne shell这样的各种类型的shell都缺少该命令历史记录。 C Shell的另一个显着特征是“别名”。

The complete path-name for the C shell is /bin/csh. By default, it uses the prompt hostname# for the root user and hostname% for the non-root users.

C Shell的完整路径名是/ bin / csh。 默认情况下,它对根用户使用提示符hostname# ,对非根用户使用提示符hostname%

4. Korn Shell (ksh) (4. The Korn Shell (ksh))

The Korn shell was developed at AT&T Bell Labs by David Korn, to improve the Bourne shell. It is denoted as ksh. The Korn shell is essentially a superset of the Bourne shell.

Korn壳由David Korn在AT&T贝尔实验室开发,用于改进Bourne壳。 它表示为ksh。 Korn壳实质上是Bourne壳的超集。

Besides supporting everything that would be supported by the Bourne shell, it provides users with new functionalities. It allows in-built support for arithmetic operations while offereing interactive features which are similar to the C shell.

除了支持Bourne Shell支持的所有功能之外,它还为用户提供了新功能。 它提供对算术运算的内置支持,同时提供类似于C shell的交互式功能。

The Korn shell runs scripts made for the Bourne shell, while offering string, array and function manipulation similar to the C programming language. It also supports scripts which were written for the C shell. Further, it is faster than most different types of shells in Linux, including the C shell.

Korn shell运行为Bourne shell创建的脚本,同时提供类似于C编程语言的字符串,数组和函数操作。 它还支持为C Shell编写的脚本。 此外,它比Linux中大多数不同类型的Shell(包括C Shell)要快。

The complete path-name for the Korn shell is /bin/ksh. By default, it uses the prompt # for the root user and $ for the non-root users.

Korn Shell程序的完整路径名是/ bin / ksh。 默认情况下,它对根用户使用提示符 ,对非根用户使用提示符$

5. Z Shell (zsh) (5. The Z Shell (zsh))

The Z Shell or zsh is a sh shell extension with tons of improvements for customization. If you want a modern shell that has all the features a much more, the zsh shell is what you’re looking for.

Z Shell或zsh是sh shell扩展,具有大量的自定义改进功能。 如果您想要具有更多功能的现代外壳,则可以使用zsh外壳。

Some noteworthy features of the z shell include:

z shell的一些值得注意的功能包括:

  • Generate filenames based on given conditions

    根据给定条件生成文件名
  • Plugins and theming support

    插件和主题支持
  • Index of built-in functions

    内置功能索引
  • Command completion

    命令完成
  • and many more…

    还有很多…

Let us summarise the different shells in Linux which we discussed in this tutorial in the table below.

让我们总结一下下表中在本教程中讨论过的Linux中的不同Shell。

ShellComplete path-namePrompt for root userPrompt for non root user
Bourne shell (sh)/bin/sh and /sbin/sh#$
GNU Bourne-Again shell (bash)/bin/bashbash-VersionNumber#bash-VersionNumber$
C shell (csh)/bin/csh#%
Korn shell (ksh)/bin/ksh#$
Z Shell (zsh)/bin/zsh<hostname>#<hostname>%
贝壳 完整的路径名 提示root用户 提示非root用户
伯恩贝壳(sh) / bin / sh和/ sbin / sh $
GNU Bourne-Again shell(bash) / bin / bash bash-VersionNumber# bash-VersionNumber $
C Shell(CSH) / bin / csh
角壳(ksh) / bin / ksh $
Z Shell(zsh) / bin / zsh <主机名># <主机名>%

结语 (Wrapping up)

Shells are one of, if not the most powerful tools available to a Linux user. Without shells, it is practically impossible for a person to utilise the features and functionality offered by the kernel installed on their system.

Shell是Linux用户可用的最强大的工具之一,如果不是的话。 没有外壳,一个人几乎不可能利用其系统上安装的内核提供的功能。

While we covered only the most commonly used types of shells in Linux, there are many other shell types worth exploring.

虽然我们仅介绍了Linux中最常用的Shell类型,但还有许多其他值得探索的Shell类型。

We hope this tutorial was able to help you to get understand the concept of shells, along with the properties of the different types of shells in Linux. If you have any feedback, queries, or suggestions, feel free to reach out to us in the comments below.

我们希望本教程能够帮助您了解shell的概念以及Linux中不同类型shell的属性。 如果您有任何反馈,疑问或建议,请随时通过以下评论与我们联系。

翻译自: https://www.journaldev.com/39194/different-types-of-shells-in-linux

linux的shell类型

  • 3
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值