Fish 速查
安装
bash
# Debian / Ubuntu
sudo apt update && sudo apt install -y fish
# RHEL / Rocky / Fedora
sudo dnf install -y fish
# Arch / Manjaro
sudo pacman -S --needed fish
# openSUSE
sudo zypper install -y fish启动和默认 Shell
bash
fish
exit
fish --version
which fish
cat /etc/shells
chsh -s /usr/bin/fish
echo $SHELL如果 Fish 不在 /etc/shells:
bash
echo /usr/bin/fish | sudo tee -a /etc/shells
chsh -s /usr/bin/fish配置文件
text
~/.config/fish/config.fish创建:
bash
mkdir -p ~/.config/fish
touch ~/.config/fish/config.fish常用配置:
fish
set -gx EDITOR vim
set -gx LANG zh_CN.UTF-8
fish_add_path ~/.local/bin
fish_add_path ~/bin
alias ll='ls -alF'
alias gs='git status'重新加载:
fish
source ~/.config/fish/config.fish插件
Web 配置:
bash
fish_configFisher:
fish
curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher排查
bash
which fish
fish --version
cat ~/.config/fish/config.fish
source ~/.config/fish/config.fish常见问题:
fish找不到:确认安装和 PATHchsh不生效:重新登录,确认路径在/etc/shells- Bash 脚本不能直接粘贴到 Fish:用
bash script.sh - PATH 不生效:优先用
fish_add_path
卸载
卸载前先切回 Bash:
bash
chsh -s /bin/bash卸载:
bash
# Debian / Ubuntu
sudo apt remove -y fish
# RHEL / Rocky / Fedora
sudo dnf remove -y fish
# Arch / Manjaro
sudo pacman -Rns fish