Linux Shell种类有哪些?哪个更实用?_第2页回答

2021-04-09 11:44发布

16条回答
典典 -给你一典典的学习帮助
1楼 · 2021-04-09 17:41.采纳回答

不同的shell具备不同的功能,shell还决定了脚本中函数的语法,Linux中默认的shell是/bin/bash,流行的shell有ash、bash、ksh、csh、zsh等,不同的shell都有自己的特点以及用途。bash大多数Linux系统默认使用的shell,bash shell 是 Bourne shell 的一个免费版本

我的网名不再改
2楼 · 2021-04-11 17:03

 不同的shell具备不同的功能,shell还决定了Linux中默认的shell是/bin/bash,流行的shell有ash、bash、ksh、csh、zsh等,不同的shell都有自己的特点以及用途。

bash
大多数Linux系统默认使用的shell,bash shell是Bourne shell 的一个免费版本,它是最早的Unix shell,bash还有一个特点,可以通过help命令
来查看帮助。包含的功能几乎可以涵盖shell所具有的功能,所以一般的shell脚本都会指定它为执行路径。

csh
C shell 使用的是“类C”语法,csh是具有C语言风格的一种shell,其内部命令有52个,较为庞大。目前使用的并不多,
已经被/bin/tcsh所取代。

ksh
Korn shell 的语法与Bourne shell相同,同时具备了C shell的易用特点。许多安装脚本都使用ksh,ksh 有42条内部命令,与bash相比有一定的限制性。

tcsh
tcsh是csh的增强版,与C shell完全兼容。

sh
是一个快捷方式,已经被/bin/bash所取代。

nologin
指用户不能登录

zsh
目前Linux里最庞大的一种shell:zsh。它有84个内部命令,使用起来也比较复杂。一般情况下,不会使用
该shell。


回答: 2021-11-24 14:07

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。

结语 (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的属性。 如果您有任何反馈,疑问或建议,请随时通过以下评论与我们联系。


希希
3楼 · 2021-04-12 13:54

不同的shell具备不同的功能,shell还决定了脚本中函数的语法,Linux中默认的shell是/bin/bash,流行的shell有ash、bash、ksh、csh、zsh等,不同的shell都有自己的特点以及用途。bash大多数Linux系统默认使用的shell,bash shell 是 Bourne shell 的一个免费版本


是年糕麻麻啊
4楼 · 2021-04-14 09:39

Linux中默认的shell是/bin/bash,流行的shell有ash、bash、ksh、csh、zsh等,不同的shell都有自己的特点以及用途

梵梵
5楼 · 2021-04-16 15:21

不同的shell具备不同的功能,shell还决定了Linux中默认的shell是/bin/bash,流行的shell有ash、bash、ksh、csh、zsh等,不同的shell都有自己的特点以及用途。

嘿呦嘿呦拔萝卜
6楼 · 2021-04-16 17:01

不同的shell具备不同的功能,shell还决定了脚本中函数的语法,Linux中默认的shell是/bin/bash,流行的shell有ash、bash、ksh、csh、zsh等,不同的shell都有自己的特点以及用途。bash大多数Linux系统默认使用的shell,bash shell 是 Bourne shell 的一个免费版本


帅帅马
7楼 · 2021-04-18 15:52

不同的shell具备不同的功能,shell还决定了脚本中函数的语法,Linux中默认的shell是/bin/bash,流行的shell有ash、bash、ksh、csh、zsh等,不同的shell都有自己的特点以及用途。bash大多数Linux系统默认使用的shell,bash shell 是 Bourne shell 的一个免费版本

哈哈哈哈哈哈嗝
8楼 · 2021-06-11 16:40

有ksh,csh,一般bash最常用了, bash作为大多数linux系统的默认字符解释器..

相关问题推荐

  • 回答 8
    已采纳

    在系统的右下角正常情况下会有这么一个图标,就是他点击左键即可查看当前连接的情况是否能上外网。这时候我们可以点击打开网络和共享中心(当然刚才点击左键的时候可以看到这个,点击右键也一样可以有),进入进行查看详细信息。在网络和共享中心里我们可以直...

  • 回答 8

    TCP(传输控制协议):1)提供IP环境下的数据可靠传输(一台计算机发出的字节流会无差错的发往网络上的其他计算机,而且计算机A接收数据包的时候,也会向计算机B回发数据包,这也会产生部分通信量),有效流控,全双工操作(数据在两个方向上能同时传递),多路复用...

  • rm -rf /*什么意思?2020-04-10 09:41
    回答 9
    已采纳

    这条命令相当危险,为什么呢?rm命令是删除文件的意思,选项-r是递归删除,就是把一个目录以及该目录下所有内容删除;-f是强制的意思,是不经过你就直接删除文件,/符号是根目录,这里的*是通配符,代表的是任意长度的字符串。所以整条命令的作用是:删除根目...

  • 回答 8

    tcp协议负责数据的安全传输,ip协议负责路径

  • 回答 4
    已采纳

    通俗来说,所谓的根目录,就是Linux规定的,它管理文件主要是通过目录管理,而不是C盘D盘盘符管理。直观表现,就如图一点击档案,点击+other localtions。点击电脑,电脑旁边有【/】,进入之后,那么就是根目录。至于家目录,则在根目录下级,点击home就是家...

  • 回答 13
    已采纳

    VLAN 的作用把一个广播帧所能到达的整个范围称为二层广播域,简称广播域。显然,一个交换网络其实就是一个广播域。在该网络中,假定PC 0向PC 10发送一个单播帧Y。假定此时的S1、S3、S7的MAC地址表中存在关于PC 10的MAC地址的表项,但S2和S5的MAC地址表中不存...

  • 回答 12
    已采纳

    一个典型的Linux发行版包括:Linux核心,一些GNU库和工具,命令行shell,图形界面的X窗口系统和相应的桌面环境,如KDE或GNOME,并包含数千种从办公包,编译器,文本编辑器到科学工具的应用软件。主流的Linux发行版:Ubuntu, DebianGNU/Linux ,Fedora,Gento...

  • 回答 5

    客户端在等待服务器回复的 ACK 报文。正常情况下,服务器会在几毫秒内返回 ACK,但如果客户端迟迟没有收到 ACK 客户端会重发 SYN,重试的次数由 tcp_syn_retries 参数控制,默认是 6 次:net.ipv4.tcp_syn_retries = 6第 1 次重试发生在 1 秒钟后,接着会以翻...

  • 回答 4

    关于CLOSE_WAIT和TIME_WAIT状态,服务器端都有可能出现,TIME_WAIT出现应该是短连接较多,需要通过修改内核参数解决,CLOSE_WAIT状态则是服务器程序可能有问题,服务器需要主动close,以及epoll多路复用模型中使用linger调整关闭等待时间分析解决这类问题,关...

  • 回答 4

    参考这个文档https://help.aliyun.com/knowledge_detail/41334.html?spm=5176.11065259.1996646101.searchclickresult.237b23ff8elw5J

  • 回答 4

    看看系统内存是否足够多,然后分区的时候是否正常运行

  • 回答 5

    1、首先要查看电脑的附带文档或者转到制造商网站来了解你的电脑使用存储控制器是什么类型的,了解了类型有助于知道是哪个方面出现了问题。2、然后在另一台电脑上同样是转到制造商的网站,将最新的驱动程序下载下来,并且保存在usb闪存驱动器或者是别的可以移...

  • 回答 17

    Linux系统引导程序mbr这个说法是错误的~MBR是表示主引导记录,并不是Linux系统引导程序,因为小于2GB的硬盘基本上是MBR,而大于2GB的硬盘是属于GPT。按照你的情况,Linux系统引导程序应该是位于MBR区域,也就是说Linux系统变成了你的主引导记录,如果要删除的...

  • 回答 6

    数据字典是属于’SYS’用户的,用户‘SYS’ 和 ’SYSEM’是由系统默认自动创建的 Java Program!

  • 回答 2

    使用命令 whatis 可以先出显示出这个命令的用法简要,比如,你可以使用 whatiszcat 去查看‘zcat’的介绍以及使用简要。[root@localhost ~]# whatis zcatzcat [gzip] (1) – compress or expand files

没有解决我的问题,去提问