fish shell Friendly interactive shell
Light · Postcard
102 × 152 mm · PDF
Dark · Postcard
102 × 152 mm · PDF
Ink saver · Postcard
102 × 152 mm · PDF
Light · A4 landscape
297 × 210 mm · PDF
Dark · A4 landscape
297 × 210 mm · PDF
Ink saver · A4 landscape
297 × 210 mm · PDF
Light · A3 landscape
420 × 297 mm · PDF
Dark · A3 landscape
420 × 297 mm · PDF
Ink saver · A3 landscape
420 × 297 mm · PDF
Start here
RightTababbr -a <name> <text>
set -gx <NAME> <value>
function <name> ... end
funcsave <name>
fish_add_path <dir>
fish_configConcepts
Suggestions & Completion
Right / Ctrl+F
Alt+Right / Alt+F
Tab~/.config/fish/completions/<cmd>.fish
Command-line Keys
Ctrl+A / Ctrl+E
Ctrl+WCtrl+UCtrl+LCtrl+CCtrl+DAlt+EAlt+SAlt+Hfish_vi_key_bindings
fish_key_readerHistory & Directories
Up / DownCtrl+RAlt+Up / Alt+Down
history search <text>
fish --privateprevd / nextdVariables & Lists
set <name> <value>
set -gx <NAME> <value>
set -U <name> <value>
set -l <name> <value>
set -e <name>
set -q <name>
fish_add_path <dir>
set <name> a b c
$name[2]$name[-1]$status$argvExpansion
(<cmd>)"$(<cmd>)"
file{,.bak}**/*.txtControl Flow
if test -f <file> echo yeselse if test -d <file> echo direlse echo noend
for f in *.txt echo $fendwhile read -l line echo $lineend < <file>
switch $xcase a b echo abcase '*' echo otherend
test -e <path>
<a>; and <b>
<a>; or <b>
read -l <var>
math <a> + <b>
argparse 'h/help' 'n/name=' -- $argv
Functions & Abbreviations
function <name> ... end
function <name> -w <cmd> -d
'<text>'
funced <name>
funcsave <name>
command <cmd>
abbr -a <name> <text>
abbr -a --position anywhere <name> <text>
Ctrl+SpaceStrings
string match -r '<regex>' <text>
string match -rg '<(re)>' <text>
string replace -a <old> <new>
<text>
string split <sep> <text>
string trim <text>
<cmd> | string collect
Redirection & Pipes
<cmd> > <file>
<cmd> >> <file>
<cmd> 2> <file>
<cmd> &> <file>
<cmd> &| less
Config & Prompt
~/.config/fish/config.fish
~/.config/fish/functions/<name>.fish
fish_configset -U fish_greeting
Coming from bash
| bash | fish |
|---|---|
export X=1 |
set -gx X 1 |
$? |
$status |
$(cmd) |
(cmd) or $(cmd) |
${v/a/b} |
string replace a b $v |
$((1+2)) |
math 1 + 2 |
<(cmd) |
(cmd | psub) |
[[ $a == b ]] |
test $a = b |
f() { ...; } |
function f ... end |
cmd1 && cmd2 |
cmd1; and cmd2 |
Recipes
# ~/.config/fish/config.fishfish_add_path ~/.local/binset -gx EDITOR vimabbr -a gco git checkoutabbr -a gs git statusset -g fish_greeting
function greet -d 'Say hello' argparse 'n/name=' -- $argv echo Hello $_flag_nameendfuncsave greet
for f in *.jpeg mv $f (string replace .jpeg .jpg $f)end
set -l out (git status --short | string collect)echo "$out"# without collect, $out would be a list of lines
Help
help <topic>



