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”。我們將在下一篇文章中學習更多關於這類命令的內容。敬請關注!
廣告