Questions tagged [fish]

The fish shell is an alternate shell, and scripting language, for *nix systems (including macOS). Its claim to fame is being an intuitive, user friendly, and efficient modern shell. Some key examples, per their own website, are enhanced syntax highlighting, completions and autosuggestions (automatically generated from man pages), high performance, and sane scripting.

Fish is a command-line shell designed to be both smart and user-friendly, with auto-suggestions, fully 256 color support, and web-based configuration. Packages for Fish exist for macOS and various flavors of Unix.

Features that differentiate it include rich syntax coloring, auto-completion of commands and arguments, and a high-performance, multithreaded implementation.

Resources

991 questions
283
votes
12 answers

Define an alias in fish shell

I would like to define some aliases in fish. Apparently it should be possible to define them in ~/.config/fish/functions but they don't get auto loaded when I restart the shell. Any ideas?
armandino
  • 17,625
  • 17
  • 69
  • 81
243
votes
18 answers

How can I set my default shell on a Mac, e.g. to Fish?

I do not like to retype fish every time I start terminal. I want Fish on by default. How can I set the Fish shell as my default shell on a Mac?
Léo Léopold Hertz 준영
  • 134,464
  • 179
  • 445
  • 697
229
votes
10 answers

Suppress or Customize Intro Message in Fish Shell

Is it possible to remove the intro message in fish shell: Welcome to fish, the friendly interactive shell Type help for instructions on how to use fish
Kevin Sylvestre
  • 37,288
  • 33
  • 152
  • 232
162
votes
8 answers

Modifying PATH with fish shell

I'm currently playing around with the fish shell and I'm having some trouble wrapping my head around how the PATH variable is set. For what it's worth, I'm also using oh-my-fish. If I echo my current path I get: ➜ fish echo $PATH /usr/local/bin…
Paymahn Moghadasian
  • 9,301
  • 13
  • 56
  • 94
140
votes
4 answers

How to set environment variables in fish shell

Can someone please tell me what's the correct way to set a bunch of environment variables in the fish shell? In my ~/.config/fish/config.fish file, I have a function to setup my environment variables like so: function setTESTENV set -x…
cfpete
  • 4,143
  • 8
  • 27
  • 23
124
votes
9 answers

How to get virtualenv to work with fish shell?

I'm trying to get virtualenv to work with the fish shell. I have virtualenv installed and it works fine with bash and zsh. However, running the following command returns fish: Unknown command 'source': $ source ~/path/to/bin/activate Does anyone…
drbunsen
  • 10,139
  • 21
  • 66
  • 94
116
votes
1 answer

How do you dynamically reload fish config files as you would in bash?

I am looking for the equivalent of source .bashrc for Fish.
Paul Wenzel
  • 1,886
  • 2
  • 15
  • 15
113
votes
1 answer

How do I unset a variable in the fish shell?

In bash I can unset a variable with unset myvar In fish I get fish: Unknown command 'unset' What's the equivalent for unset in fish.
J0hnG4lt
  • 4,337
  • 5
  • 24
  • 40
109
votes
2 answers

How to use vi mode in fish shell?

I saw vi-mode implementation for fish shell, but I have no clue how to use it. Is there any tutorial available online describing basic functionality, e.g. how to switch modes?
sandric
  • 2,310
  • 3
  • 21
  • 26
64
votes
3 answers

Fish equivalent of bash $(command) notation

I am currently trying out the fish shell instead of using bash. One type of notation I'm having trouble learning the fish-equivalent notation for is $(command), similar to how it is described in this SOF post. How do I write this using fish? Keep in…
ecbrodie
  • 11,246
  • 21
  • 71
  • 120
63
votes
1 answer

How to get exit status of program in fish shell

In the bash shell, I could echo $? to get the exit code of a program run on the cli. What is the equivalent in the fish shell? Can't seem to find this in the docs.
Darc Nawg
  • 1,415
  • 3
  • 15
  • 25
60
votes
2 answers

Test for string equality / string comparison in Fish shell?

How do you compare two strings in Fish (like "abc" == "def" in other languages)? So far, I've used a combination of contains (turns out that contains "" $a only returns 0 if $a is the empty string, although that hasn't seemed to work for me in all…
Daisy Leigh Brenecki
  • 7,571
  • 6
  • 28
  • 43
53
votes
1 answer

My fish is blind? (fish does not recognise any commands after setting it as default shell on Mac OS Big Sur, M1 Mac)

I installed fish with homebrew on Mac OS Big Sur, Apple Silicon. Then I added /opt/homebrew/bin/fish to /etc/shells. When I now start fish from the default shell, it recognises all commands (like git flow init). After changing the default shell with…
dusen
  • 531
  • 1
  • 4
  • 3
52
votes
3 answers

fish shell. How to check if a variable is set/empty?

How can I do something like set variable (some_command_that_may_return_a_string) if [ variable is set ] do_something and inversely how do I check if the variable is empty?
Adham Zahran
  • 1,973
  • 2
  • 18
  • 35
52
votes
2 answers

pipe both, stdout and stderr in the fish shell

I know this has been an issue for a while and I found a lot of discussion about it, however I didn't get which would be finally a way to get it done: pipe both, stdout and stderr. In bash, this would be simply: cmd 2>&1 | cmd2
Anton Harald
  • 5,772
  • 4
  • 27
  • 61
1
2 3
65 66