mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-03-03 01:10:13 +08:00
commit
c65d1aabbb
@ -1,90 +0,0 @@
|
||||
翻译中;by ping
|
||||
Top 5 open source command shells for Linux
|
||||
===============================================
|
||||
|
||||
keyword: shell , Linux , bash , zsh , fish , ksh , tcsh , license
|
||||
|
||||

|
||||
|
||||
There are two kinds of Linux users: the cautious and the adventurous.
|
||||
|
||||
On one side is the user who almost reflexively tries out ever new option which hits the scene. They’ve tried handfuls of window managers, dozens of distributions, and every new desktop widget they can find.
|
||||
|
||||
On the other side is the user who finds something they like and sticks with it. They tend to like their distribution’s defaults. If they’re passionate about a text editor, it’s whichever one they mastered first.
|
||||
|
||||
As a Linux user, both on the server and the desktop, for going on fifteen years now, I am definitely more in the second category than the first. I have a tendency to use what’s presented to me, and I like the fact that this means more often than not I can find thorough documentation and examples of most any use case I can dream up. If I used something non-standard, the switch was carefully researched and often predicated by a strong pitch from someone I trust.
|
||||
|
||||
But that doesn’t mean I don’t like to sometimes try and see what I’m missing. So recently, after years of using the bash shell without even giving it a thought, I decided to try out four alternative shells: ksh, tcsh, zsh, and fish. All four were easy installs from my default repositories in Fedora, and they’re likely already packaged for your distribution of choice as well.
|
||||
|
||||
Here’s a little bit on each option and why you might choose it to be your next Linux command-line interpreter.
|
||||
|
||||
### bash
|
||||
|
||||
First, let’s take a look back at the familiar. [GNU Bash][1], the Bourne Again Shell, has been the default in pretty much every Linux distribution I’ve used through the years. Originally released in 1989, bash has grown to easily become the most used shell across the Linux world, and it is commonly found in other unix-like operating systems as well.
|
||||
|
||||
Bash is a perfectly respectable shell, and as you look for documentation of how to do various things across the Internet, almost invariably you’ll find instructions which assume you are using a bash shell. But bash has some shortcomings, as anyone who has ever written a bash script that’s more than a few lines can attest to. It’s not that you can’t do something, it’s that it’s not always particularly intuitive (or at least elegant) to read and write. For some examples, see this list of [common bash pitfalls][2].
|
||||
|
||||
That said, bash is probably here to stay for at least the near future, with its enormous install base and legions of both casual and professional system administrators who are already attuned to its usage, and quirks. The bash project is available under a [GPLv3][3] license.
|
||||
|
||||
### ksh
|
||||
|
||||
[KornShell][4], also known by its command invocation, ksh, is an alternative shell that grew out of Bell Labs in the 1980s, written by David Korn. While originally proprietary software, later versions were released under the [Eclipse Public License][5].
|
||||
|
||||
Proponents of ksh list a number of ways in which they feel it is superior, including having a better loop syntax, cleaner exit codes from pipes, an easier way to repeat commands, and associative arrays. It's also capable of emulating many of the behaviors of vi or emacs, so if you are very partial to a text editor, it may be worth giving a try. Overall, I found it to be very similar to bash for basic input, although for advanced scripting it would surely be a different experience.
|
||||
|
||||
### tcsh
|
||||
|
||||
[Tcsh][6] is a derivative of csh, the Berkely Unix C shell, and sports a very long lineage back to the early days of Unix and computing itself.
|
||||
|
||||
The big selling point for tcsh is its scripting language, which should look very familiar to anyone who has programmed in C. Tcsh's scripting is loved by some and hated by others. But it has other features as well, including adding arguments to aliases, and various defaults that might appeal to your preferences, including the way autocompletion with tab and history tab completion work.
|
||||
|
||||
You can find tcsh under a [BSD license][7].
|
||||
|
||||
### zsh
|
||||
|
||||
[Zsh][8] is another shell which has similarities to bash and ksh. Originating in the early 90s, zsh sports a number of useful features, including spelling correction, theming, namable directory shortcuts, sharing your command history across multiple terminals, and various other slight tweaks from the original Bourne shell.
|
||||
|
||||
The code and binaries for zsh can be distributed under an MIT-like license, though portions are under the GPL; check the [actual license][9] for details.
|
||||
|
||||
### fish
|
||||
|
||||
I knew I was going to like the Friendly Interactive Shell, [fish][10], when I visited the website and found it described tongue-in-cheek with "Finally, a command line shell for the 90s"—fish was written in 2005.
|
||||
|
||||
The authors of fish offer a number of reasons to make the switch, all invoking a bit of humor and poking a bit of fun at shells that don't quite live up. Features include autosuggestions ("Watch out, Netscape Navigator 4.0"), support of the "astonishing" 256 color palette of VGA, but some actually quite helpful features as well including command completion based on the man pages on your machine, clean scripting, and a web-based configuration.
|
||||
|
||||
Fish is licensed primarily unde the GPL version 2 but with portions under other licenses; check the repository for [complete information][11].
|
||||
|
||||
***
|
||||
|
||||
Looking for a more detailed rundown on the precise differences between each option? [This site][12] ought to help you out.
|
||||
|
||||
So where did I land? Well, ultimately, I’m probably going back to bash, because the differences were subtle enough that someone who mostly used the command line interactively as opposed to writing advanced scripts really wouldn't benefit much from the switch, and I'm already pretty comfortable in bash.
|
||||
|
||||
But I’m glad I decided to come out of my shell (ha!) and try some new options. And I know there are many, many others out there. Which shells have you tried, and which one do you prefer? Let us know in the comments!
|
||||
|
||||
|
||||
|
||||
|
||||
via: https://opensource.com/business/16/3/top-linux-shells
|
||||
|
||||
作者:[Jason Baker][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://opensource.com/users/jason-baker
|
||||
|
||||
[1]: https://www.gnu.org/software/bash/
|
||||
[2]: http://mywiki.wooledge.org/BashPitfalls
|
||||
[3]: http://www.gnu.org/licenses/gpl.html
|
||||
[4]: http://www.kornshell.org/
|
||||
[5]: https://www.eclipse.org/legal/epl-v10.html
|
||||
[6]: http://www.tcsh.org/Welcome
|
||||
[7]: https://en.wikipedia.org/wiki/BSD_licenses
|
||||
[8]: http://www.zsh.org/
|
||||
[9]: https://sourceforge.net/p/zsh/code/ci/master/tree/LICENCE
|
||||
[10]: https://fishshell.com/
|
||||
[11]: https://github.com/fish-shell/fish-shell/blob/master/COPYING
|
||||
[12]: http://hyperpolyglot.org/unix-shells
|
||||
|
@ -0,0 +1,86 @@
|
||||
最牛的五个Linux开源command shell
|
||||
===============================================
|
||||
|
||||
关键字: shell , Linux , bash , zsh , fish , ksh , tcsh , license
|
||||
|
||||

|
||||
|
||||
这个世界上有两种Linux用户:敢于冒险的和态度谨慎的。
|
||||
|
||||
其中一类用户总是本能的去尝试任何能够戳中其痛点的新选择。他们尝试过不计其数的窗口管理器、系统发行版和几乎所有能找到的桌面插件。
|
||||
|
||||
另一类用户找到他们喜欢的东西后,会一直使用下去。他们往往喜欢所使用的系统发行版的默认选项。最先熟练掌握的文本编辑器会成为他们最钟爱的那一个。
|
||||
|
||||
作为一个使用桌面版和服务器版十五年之久的Linux用户,比起第一类来,我无疑属于第二类用户。我更倾向于使用现成的东西,如此一来,很多时候我就可以通过文档和示例方便地找到我所需要的使用案例。如果我决定选择使用非费标准的东西,这个切换过程一定会基于细致的研究,并且前提是来自挚友的大力推荐。
|
||||
|
||||
但这并不意味着我不喜欢尝试新事物并且查漏补失。所以最近一段时间,在我不假思索的使用了bash shell多年之后,决定尝试一下另外四个shell工具:ksh, tcsh, zsh, 和 fish. 这四个shell都可以通过我所以用的Fedora系统的默认库轻松安装,并且他们可能已经内置在你所使用的系统发行版当中了。
|
||||
|
||||
这里对每个选择都稍作介绍,并且阐述下它适合做为你的下一个Linux命令行解释器的原因所在。
|
||||
|
||||
### bash
|
||||
|
||||
首先,我们回顾一下最为熟悉的一个。 [GNU Bash][1],又名 Bourne Again Shell,它是我这些年使用过的众多Linux发行版的默认选择。它最初发布于1989年,并且轻松成长为Linux世界中使用最广泛的shell,甚至常见于其他一些类Unix系统当中。
|
||||
|
||||
Bash是一个广受赞誉的shell,当你通过互联网寻找各种事情解决方法所需的文档时,总能够无一例外的发现这些文档都默认你使用的是bash shell。但Bash也有一些缺点存在,如果你写过Bash脚本就会发现我们写的代码总是得比真正所需要的多那么几行。这并不是说有什么事情是它做不到的,而是说它读写起来并不总是那么直观,至少是不够优雅。
|
||||
|
||||
如上所述,基于其巨大的安装量,并且考虑到各类专业和非专业系统管理员已经适应了它的使用方式和独特之处,至少在将来一段时间内,bash或许会一直存在。
|
||||
|
||||
### ksh
|
||||
|
||||
[KornShell][4],或许你对这个名字并不熟悉,但是你一定知道它的调用命令 ksh。这个替代性的shell于80年代起源于贝尔实验室,由David Korn所写。虽然最初是一个专有软件,但是后期版本是在[Eclipse Public 许可][5]下发布的。
|
||||
|
||||
ksh的拥趸们列出了他们觉得其优越的诸多理由,包括更好的循环语法,清晰的管道退出代码,更简单的方式来处理重复命令和关联数组。它能够模拟vi和emacs的许多行为,所以如果你是一个重度文本编辑器患者,它值得你一试。最后,我发现它虽然在高级脚本方面拥有不同的体验,但在基本输入方面与bash如出一辙。
|
||||
|
||||
### tcsh
|
||||
|
||||
[Tcsh][6]衍生于csh(Berkely Unix C shell),并且可以追溯到早期的Unix和计算本身。
|
||||
|
||||
Tcsh最大的卖点在于它的脚本语言,对于熟悉C语言编程的人来说,看起来会非常亲切。Tcsh的脚本编写有人喜欢,有人憎恶。但是它也有其他的技术特色,包括可以为aliases添加参数,各种可能迎合你偏好的默认行为,包括tab自动完成和将tab完成的工作记录下来以备后查。
|
||||
|
||||
你可以在[BSD 许可][7]下找到tcsh。
|
||||
|
||||
### zsh
|
||||
|
||||
[Zsh][8]是另外一个与bash和ksh有着相似之处的shell。产生于90年代初,zsh支持众多有用的新技术,包括拼写纠正,主题化,可命名的目录快捷键,在多个终端中分享命令历史信息和各种相对于original Bourne shell的轻微调整。
|
||||
|
||||
虽然部分需要遵照GPL许可,但zsh的代码和二进制文件可以在MIT-like许可下进行分发; 你可以在 [actual license][9] 中查看细节。
|
||||
|
||||
### fish
|
||||
|
||||
之前我访问了[fish][10]的主页,当看到 “好了,这是一个为90年代而生的命令行shell” 这条略带调侃的介绍时(fish完成于2005年),我就意识到我会爱上这个交互友好的shell的。
|
||||
|
||||
Fish的作者提供了若干切换过来的理由,shell中所有的不太实用的调用都有点小幽默并且能戳中笑点。这些特性包括自动建议("Watch out, Netscape Navigator 4.0"),支持“惊人”的256色VGA调色,不过也有真正有用的特性,包括根据机器的man页面自动补全命令,清除脚本和基于web的配置。
|
||||
|
||||
Fish的许可主要基于第二版GPL,但有些部分是在其他许可下的。你可以查看资源库来了解[完整信息][11]
|
||||
|
||||
***
|
||||
|
||||
如果你想要寻找关于每个选择确切不同之处的详尽纲要,[这个网站][12]应该可以帮到你。
|
||||
|
||||
我的立场到底是怎样的呢?好吧,最终我应该还是会重新投入bash的怀抱,因为对于大多数时间都在使用命令行交互的人来说,切换过程对于高级脚本能带来的好处微乎其微,并且我已经习惯于使用bash了。
|
||||
|
||||
但是我很庆幸做出了敞开大门并且尝试新选择的决定。我知道门外还有许许多多其他的东西。你尝试过哪些shell,更中意哪一个?请在评论里告诉我们。
|
||||
|
||||
本文来源: https://opensource.com/business/16/3/top-linux-shells
|
||||
|
||||
作者:[Jason Baker][a]
|
||||
译者:[mr-ping](https://github.com/mr-ping)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://opensource.com/users/jason-baker
|
||||
|
||||
[1]: https://www.gnu.org/software/bash/
|
||||
[2]: http://mywiki.wooledge.org/BashPitfalls
|
||||
[3]: http://www.gnu.org/licenses/gpl.html
|
||||
[4]: http://www.kornshell.org/
|
||||
[5]: https://www.eclipse.org/legal/epl-v10.html
|
||||
[6]: http://www.tcsh.org/Welcome
|
||||
[7]: https://en.wikipedia.org/wiki/BSD_licenses
|
||||
[8]: http://www.zsh.org/
|
||||
[9]: https://sourceforge.net/p/zsh/code/ci/master/tree/LICENCE
|
||||
[10]: https://fishshell.com/
|
||||
[11]: https://github.com/fish-shell/fish-shell/blob/master/COPYING
|
||||
[12]: http://hyperpolyglot.org/unix-shells
|
||||
|
Loading…
Reference in New Issue
Block a user