怎么在Linux中安裝、配置和使用FishShell

這篇文章主要講解了“怎么在Linux中安裝、配置和使用Fish Shell”,文中的講解內(nèi)容簡單清晰,易于學(xué)習(xí)與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“怎么在Linux中安裝、配置和使用Fish Shell”吧!

創(chuàng)新互聯(lián)建站專注于網(wǎng)站建設(shè),為客戶提供成都網(wǎng)站建設(shè)、網(wǎng)站建設(shè)、網(wǎng)頁設(shè)計(jì)開發(fā)服務(wù),多年建網(wǎng)站服務(wù)經(jīng)驗(yàn),各類網(wǎng)站都可以開發(fā),品牌網(wǎng)站建設(shè),公司官網(wǎng),公司展示網(wǎng)站,網(wǎng)站設(shè)計(jì),建網(wǎng)站費(fèi)用,建網(wǎng)站多少錢,價格優(yōu)惠,收費(fèi)合理。

什么是 Fish Shell?

Fish 是友好的交互式 shell ,是一個功能齊全,智能且對用戶友好的 Linux 命令行 shell ,它帶有一些在大多數(shù) shell 中都不具備的方便功能。

這些功能包括自動補(bǔ)全建議、Sane Scripting、手冊頁補(bǔ)全、基于 Web 的配置器和 Glorious VGA Color 。你對它感到好奇并想測試它嗎?如果是這樣,請按照以下安裝步驟繼續(xù)安裝。

如何在 Linux 中安裝 Fish Shell ?

它的安裝非常簡單,除了少數(shù)幾個發(fā)行版外,它在大多數(shù)發(fā)行版中都沒有。但是,可以使用以下 fish 倉庫 輕松安裝。

對于基于 Arch Linux 的系統(tǒng), 使用 Pacman 命令 來安裝 fish shell。

$ sudo pacman -S fish

對于 Ubuntu 16.04/18.04 系統(tǒng)來說,請使用 APT-GET 命令 或者 APT 命令 安裝 fish shell。

$ sudo apt-add-repository ppa:fish-shell/release-3$ sudo apt-get update$ sudo apt-get install fish

對于 Fedora 系統(tǒng)來說,請使用 DNF 命令 安裝 fish shell。

對于 Fedora 29 系統(tǒng)來說:

$ sudo dnf config-manager --add-repo https://download.opensuse.org/repositories/shells:/fish:/release:/3/Fedora_29/shells:fish:release:3.repo$ sudo dnf install fish

對于 Fedora 28 系統(tǒng)來說:

$ sudo dnf config-manager --add-repo https://download.opensuse.org/repositories/shells:/fish:/release:/3/Fedora_28/shells:fish:release:3.repo$ sudo dnf install fish

對于 Debian 系統(tǒng)來說,請使用 APT-GET 命令 或者 APT 命令 安裝 fish shell。

對于 Debian 9 系統(tǒng)來說:

$ sudo wget -nv https://download.opensuse.org/repositories/shells:fish:release:3/Debian_9.0/Release.key -O Release.key$ sudo apt-key add - < Release.key$ sudo echo 'deb http://download.opensuse.org/repositories/shells:/fish:/release:/3/Debian_9.0/ /' > /etc/apt/sources.list.d/shells:fish:release:3.list$ sudo apt-get update$ sudo apt-get install fish

對于 Debian 8 系統(tǒng)來說:

$ sudo wget -nv https://download.opensuse.org/repositories/shells:fish:release:3/Debian_8.0/Release.key -O Release.key$ sudo apt-key add - < Release.key$ sudo echo 'deb http://download.opensuse.org/repositories/shells:/fish:/release:/3/Debian_8.0/ /' > /etc/apt/sources.list.d/shells:fish:release:3.list$ sudo apt-get update$ sudo apt-get install fish

對于 RHEL/CentOS 系統(tǒng)來說,請使用 YUM 命令 安裝 fish shell。

對于 RHEL 7 系統(tǒng)來說:

$ sudo yum-config-manager --add-repo https://download.opensuse.org/repositories/shells:/fish:/release:/3/RHEL_7/shells:fish:release:3.repo$ sudo yum install fish

對于 RHEL 6 系統(tǒng)來說:

$ sudo yum-config-manager --add-repo https://download.opensuse.org/repositories/shells:/fish:/release:/3/RedHat_RHEL-6/shells:fish:release:3.repo$ sudo yum install fish

對于 CentOS 7 系統(tǒng)來說:

$ sudo yum-config-manager --add-repo https://download.opensuse.org/repositories/shells:fish:release:2/CentOS_7/shells:fish:release:2.repo$ sudo yum install fish

對于 CentOS 6 系統(tǒng)來說:

$ sudo yum-config-manager --add-repo https://download.opensuse.org/repositories/shells:fish:release:2/CentOS_6/shells:fish:release:2.repo$ sudo yum install fish

對于 openSUSE Leap 系統(tǒng)來說,請使用 Zypper 命令 安裝 fish shell。

$ sudo zypper addrepo https://download.opensuse.org/repositories/shells:/fish:/release:/3/openSUSE_Leap_42.3/shells:fish:release:3.repo$ suod zypper refresh$ sudo zypper install fish

如何使用 Fish Shell ?

一旦你成功安裝了 fish shell 。只需在你的終端上輸入 fish ,它將自動從默認(rèn)的 bash shell 切換到 fish shell 。

$ fish

 怎么在Linux中安裝、配置和使用Fish Shell

自動補(bǔ)全建議

當(dāng)你在 fish shell 中鍵入任何命令時,它會在輸入幾個字母后以淺灰色自動建議一個命令。

怎么在Linux中安裝、配置和使用Fish Shell

一旦你得到一個建議然后按下向右光標(biāo)鍵(LCTT 譯注:原文是左,錯的)就能完成它而不是輸入完整的命令。

怎么在Linux中安裝、配置和使用Fish Shell

你可以在鍵入幾個字母后立即按下向上光標(biāo)鍵檢索該命令以前的歷史記錄。它類似于 bash shell 的 CTRL+r 選項(xiàng)。

Tab 補(bǔ)全

如果你想查看給定命令是否還有其他可能性,那么在鍵入幾個字母后,只需按一下 Tab 鍵即可。

怎么在Linux中安裝、配置和使用Fish Shell

再次按 Tab 鍵可查看完整列表。

怎么在Linux中安裝、配置和使用Fish Shell

語法高亮

fish 會進(jìn)行語法高亮顯示,你可以在終端中鍵入任何命令時看到。無效的命令被著色為 RED color 。

怎么在Linux中安裝、配置和使用Fish Shell

同樣的,有效的命令以不同的顏色顯示。此外,當(dāng)你鍵入有效的文件路徑時,fish 會在其下面加下劃線,如果路徑無效,則不會顯示下劃線。

怎么在Linux中安裝、配置和使用Fish Shell

基于 Web 的配置器

fish shell 中有一個很酷的功能,它允許我們通過網(wǎng)絡(luò)瀏覽器設(shè)置顏色、提示符、功能、變量、歷史和鍵綁定。

在終端上運(yùn)行以下命令以啟動 Web 配置界面。只需按下 Ctrl+c 即可退出。

$ fish_configWeb config started at 'file:///home/daygeek/.cache/fish/web_config-86ZF5P.html'. Hit enter to stop.qt5ct: using qt5ct plugin^CShutting down.

 怎么在Linux中安裝、配置和使用Fish Shell

手冊頁補(bǔ)全

其他 shell 支持可編程的補(bǔ)全,但只有 fish 可以通過解析已安裝的手冊頁自動生成它們。

要使用該功能,請運(yùn)行以下命令:

$ fish_update_completionsParsing man pages and writing completions to /home/daygeek/.local/share/fish/generated_completions/ 3466 / 3466 : zramctl.8.gz

如何將 Fish 設(shè)置為默認(rèn) shell

如果你想測試 fish shell 一段時間,你可以將 fish shell 設(shè)置為默認(rèn) shell,而不用每次都切換它。

要這樣做,首先使用以下命令獲取 Fish Shell 的位置。

$ whereis fishfish: /usr/bin/fish /etc/fish /usr/share/fish /usr/share/man/man1/fish.1.gz

通過運(yùn)行以下命令將默認(rèn) shell 更改為 fish shell 。

$ chsh -s /usr/bin/fish

 怎么在Linux中安裝、配置和使用Fish Shell

提示:只需驗(yàn)證 Fish Shell 是否已添加到 /etc/shells 目錄中。如果不是,則運(yùn)行以下命令以附加它。

$ echo /usr/bin/fish | sudo tee -a /etc/shells

完成測試后,如果要返回 bash shell ,請使用以下命令。

暫時返回:

$ bash

***返回:

$ chsh -s /bin/bash

感謝各位的閱讀,以上就是“怎么在Linux中安裝、配置和使用Fish Shell”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對怎么在Linux中安裝、配置和使用Fish Shell這一問題有了更深刻的體會,具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關(guān)知識點(diǎn)的文章,歡迎關(guān)注!

網(wǎng)站欄目:怎么在Linux中安裝、配置和使用FishShell
鏈接URL:http://muchs.cn/article20/pppcjo.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站建設(shè)網(wǎng)站改版、搜索引擎優(yōu)化、網(wǎng)站維護(hù)、用戶體驗(yàn)、網(wǎng)站策劃

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)公司