fish 命令详解

| 选择喜欢的代码风格  

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

fish 命令安装:


-bash/zsh: fish command not found

#Debian
apt-get install fish

#Ubuntu
apt-get install fish

#Alpine
apk add fish

#Arch Linux
pacman -S fish

#Kali Linux
apt-get install fish

#Fedora
dnf install fish

#OS X
brew install fish

#Raspbian
apt-get install fish

#Docker
docker run cmd.cat/fish fish

对于 CentOS 8,请以根用户 root 运行下面命令:
cd /etc/yum.repos.d/
wget https://download.opensuse.org/repositories/shells:fish:release:3/CentOS_8/shells:fish:release:3.repo
yum install fish

对于 CentOS 7,请以根用户 root 运行下面命令:
cd /etc/yum.repos.d/
wget https://download.opensuse.org/repositories/shells:fish:release:3/CentOS_7/shells:fish:release:3.repo
yum install fish

fish 命令补充说明:


fish 命令,在键入时会执行语法高亮显示。默认情况下,无效命令显示为红色

有句话这样说:

二逼青年用 bash,普通青年用 zsh,文艺青年用 fish.

fish 和 zsh 有个共同点是根据历史输入自动补全,只要是历史有输入的,都会有记录有提示,对于一些很长的命令,超级爽,再也不用手动复制粘贴了。

fish 是 "the friendly interactive shell" 的简称,最大特点就是方便易用。很多其他 Shell 需要配置才有的功能,Fish 默认提供,不需要任何配置

fish 命令语法:


fish [-h] [-v] [-c command] [FILE [ARGUMENTS...]]

fish 命令选项:


· -c or --command=COMMANDS evaluate the specified commands instead of reading from the commandline, passing any additional positional arguments via $argv. Note  that,  unlike  other
         shells, the first argument is not the name of the program ($0), but simply the first normal argument.

· -C or --init-command=COMMANDS evaluate the specified commands after reading the configuration, before running the command specified by -c or reading interactive input

· -d or --debug=DEBUG_CATEGORIES enable debug output and specify a pattern for matching debug categories. See Debugging below for details.

· -o or --debug-output=DEBUG_FILE specify a file path to receive the debug output, including categories and fish_trace. The default is stderr.

· -i or --interactive specify that fish is to run in interactive mode

· -l or --login specify that fish is to run as a login shell

· -n or --no-execute do not execute any commands, only perform syntax checking

· -p  or  --profile=PROFILE_FILE when fish exits, output timing information on all executed commands to the specified file. This excludes time spent starting up and reading the con‐
 figuration.

· --profile-startup=PROFILE_FILE will write timing information for fish's startup to the specified file. This is useful to profile your configuration.

· -P or --private enables private mode, so fish will not access old or store new history.

· --print-rusage-self when fish exits, output stats from getrusage

· --print-debug-categories outputs the list of debug categories, and then exits.

· -v or --version display version and exit

· -f or --features=FEATURES enables one or more feature flags (separated by a comma). These are how fish stages changes that might break scripts.

The fish exit status is generally the exit status of the last foreground command.

fish 命令实例:


启动 fish 交互式 Shell

fish

fish 执行一个命令:

fish -c "command"

fish 从文件运行命令:

fish file.fish

fish 检查文件中的语法错误:

fish --no-execute file.fish

显示 fish 版本信息并退出:

fish --version

fish 命令扩展阅读:




fish 命令评论