Fish
Install
Install fish via homebrew
brew install fishSet fish as default shell
echo /usr/local/bin/fish | sudo tee -a /etc/shells
sudo chsh -s $(which fish) $(whoami)Default fish config folder location
~/.config/fishCompletions
Update man page completions
fish_update_completionsFunctions
List available fish functions
functionsShow source for specific function (type provides syntax highlighting)
functions <function-name>List Builtin function names
builtin --namesEnvironment
Set environment variable for command
env <variable>=<value> <command>Abbreviations
Add (-a) global (-g) abbreviation
abbr -ag gc 'git ci -m'Add (-a) global (-g) abbreviation and set cursor position
abbr -ag gc --set-cursor=@ 'git ci -m "@"'List full abbreviations or abbreviation names
abbr
abbr --listRemove abbreviation
abbr -e <abbr>Rename abbreviation
abbr -r <old-abbr> <new-abbr>Command History
Show all command history items
historyClear all command history items
history clearLimit history results (show count most recent entries, eg. -5 five entries)
history -<count>
history -5Include timestamp of command in history output
--show-time -tShow history matching filter and string criteria (optionally limit to -n results)
history search <filter> <string>
history search <filter> <string> -n <count>Delete history matching filter and string criteria
history delete <filter> <string>History result filters
--exact -e
--prefix -p
--contains -cSet filter string to be case sensitive
--case-sensitive -CList history entries that contain the specified string
history search --contains <string>Delete history entries that contain the specified string
history delete --contains <string>Search command history from string using grep
history | grep -i <string>Directory Navigation
Cycle through previous and next visited directories
prevd
nextdShow the ordered directory history available to prevd and nextd
dirhShow numbered list of recent directories to allow jumping to specified directory
cdhPrivate Mode
Use private mode for running commands with tokens or other context that should not be persisted to history
fish --private
fish -PString Functions
Search and replace string content (-r for regex)
string replace -r <search> <replace> <input>Keyboard Shortcuts
Directory Navigation
Cycle through prevd and nextd entries (when command empty)
OPT + LEFT / RIGHT ARROWList directory history (when current command is empty)
ALT + DRun ls for current directory
ALT + LCommand Completion
Show completions for current token (command, attribute or path)
TABShow completions with search filter for current token
SHIFT + TABAccept displayed autosuggestion
RIGHT ARROWCycle through previous commands using current input
UP / DOWN ARROWShow searchable command history (using current command is filter)
CTRL + RCycle through older and newer commands in searchable command history
CTRL + R
CTRL + SCommand Editing
Clear (or halt) current command
CTRL + CMove the cursor to the beginning or end of the current command
CTRL + A
CTRL + EMove cursor by one word within current command
OPT + LEFT / RIGHT ARROWMove cursor by one word (ignoring punctuation) within current command
SHIFT + LEFT / RIGHT ARROWDelete one character to the right of the cursor
CTRL + DDelete from the beginning of the line to the cursor
CTRL + UDelete from the cursor to the end of the command
CTRL + UDelete one path component
CTRL + WAdd new line to command at current cursor position
ALT + ENTERHelpers
Print short help description for command at cursor
ALT + WShow man page for current command
ALT + HAdd pipe to less pager for current command
ALT + POpen file name at cursor in less pager
ALT + OAppend sudo to current command
ALT + SEdit current command in external editor (set via $VISUAL and $EDITOR variables)
ALT + E
ALT + VUtilities
Output performance timings for fish shell startup
fish --profile-startup <file> -i -c exitLast updated