Fish – 一款智能且用户友好的 Linux 交互式 Shell


被称为 FISH(全称 Pleasant Interactive Shell)的 **友好型交互式 Shell** 是一款用于 UNIX 和类 UNIX 操作系统的 Shell。它是一个独特而创新的命令行环境,拥有许多宝贵的改进。Fish 旨在与其他 Shell(如 bash 或 ZSH)一起工作。与许多默认情况下禁用某些功能以节省系统资源的其他 Shell 不同,Fish 默认情况下启用所有功能,以充分利用其优势。

特性

  • 这是一个用户友好且交互式的 Shell
  • 它拥有许多强大的功能
  • 内置基于 Web 的配置
  • 支持绚丽的 VGA 颜色和 256 种终端颜色
  • 支持 X 剪贴板
  • 错误检查功能
  • 使用 help 命令查看 FISH 文档
  • 使用箭头键选择建议

安装 FISH

要安装 fish,需要 **Python 软件包**,使用以下命令安装 python –

$ sudo apt-get install python-software-properties

示例输出如下:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
   python-pycurl
Suggested packages:
   libcurl4-gnutls-dev python-pycurl-dbg
The following NEW packages will be installed:
python-pycurl python-software-properties
0 upgraded, 2 newly installed, 0 to remove and 7 not upgraded.
Need to get 67.5 kB of archives.
After this operation, 358 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://in.archive.ubuntu.com/ubuntu/ trusty/main python-pycurl amd64 7.19.3-0ubuntu3 [47.9 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu/ trusty-updates/universe python-software-properties all 0.92.37.7 [19.6 kB]
Fetched 67.5 kB in 1s (45.9 kB/s)
Selecting previously unselected package python-pycurl.
(Reading database ... 218616 files and directories currently installed.)
Preparing to unpack .../python-pycurl_7.19.3-0ubuntu3_amd64.deb ...
Unpacking python-pycurl (7.19.3-0ubuntu3) ...
....................................................

现在,我们应该调用 **fish** 仓库,如下所示:

$ sudo add-apt-repository ppa:fish-shell/nightly-master

输出如下:

This repository contains regular builds of the most recent source of Fish shell, built from the Git master trunk at https://github.com/fish-shell/fish-shell/.

More info: https://launchpad.net/~fish-shell/+archive/ubuntu/nightly-master
Press [ENTER] to continue or ctrl-c to cancel adding it

gpg: keyring `/tmp/tmpzn3dsxqj/secring.gpg' created
gpg: keyring `/tmp/tmpzn3dsxqj/pubring.gpg' created
gpg: requesting key 6DC33CA5 from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpzn3dsxqj/trustdb.gpg: trustdb created
gpg: key 6DC33CA5: public key "Launchpad PPA for Fish shell maintainers" imported
gpg: Total number processed: 1
gpg:             imported: 1 (RSA: 1)
OK

使用以下命令更新 Linux 包:

$ sudo apt-get update

要安装 fish,请使用以下命令:

$ sudo apt-get install fish

输出如下:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
   linux-headers-4.2.0-27 linux-headers-4.2.0-27-generic
   linux-image-4.2.0-27-generic linux-image-extra-4.2.0-27-generic
   linux-signed-image-4.2.0-27-generic
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
   xsel
The following NEW packages will be installed:
   fish xsel
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,187 kB of archives.
After this operation, 6,568 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ppa.launchpad.net/fish-shell/nightly-master/ubuntu/ trusty/main fish amd64 2.2.0-680-ga701264-1~trusty [1,166 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu/ trusty/universe xsel amd64 1.2.0-2 [20.6 kB]
Fetched 1,187 kB in 4s (284 kB/s)
.................................

使用 Fish Shell

要使用 fish shell 命令行,请使用以下命令:

$ fish

示例输出如下:

Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish

要检查已安装的 fish 版本,请使用以下命令:

$ echo $FISH_VERSION

示例输出如下:

2.2.0-680-ga701264

要获得自动建议,只需输入“da”,它将显示如下所示的自动建议:

$ date

输出如下:

Tue Mar 15 11:29:50 IST 2016

要获取有关 **fish** 的更多信息,请使用以下命令:

$ help

示例输出如下:

要在实时自动获得智能颜色选择,请使用以下命令:

$ echo
"I am loving tutorialspoint "

输出如下:

I am loving tutorialspoint

要将 **fish** 设置为默认 Shell,请使用以下命令:

$ chsh -s /usr/bin/fish

要切换回之前的 Shell,请使用以下命令:

$ chsh -s /bin/bash

恭喜!现在您知道“如何使用 Fish – 一款智能且用户友好的 Linux 交互式 Shell”。我们将在下一篇文章中学习更多关于这类命令的内容。敬请关注!

更新于:2020年1月20日

浏览量:133

启动您的 职业生涯

通过完成课程获得认证

开始
广告