Skip to main content

Questions tagged [fish]

The friendly interactive shell (fish) is a Unix shell that focuses on interactive use, discoverability, and user friendliness.

Filter by
Sorted by
Tagged with
101 votes
2 answers
35k views

chain Fish commands via `&&` or `||`

In Bash/ZSH and other shells, I am used to using && and ||. Is there any equivalent in Fish?
Albert's user avatar
  • 6,681
67 votes
3 answers
57k views

Is there any way to get bash to have syntax highlighting like fish?

In the fish shell, the actual command line is syntax highlighted: Is there any way to get this same behavior in bash? There is something just like this but for zsh, not bash. Is it possible that ...
Wuffers's user avatar
  • 19.3k
65 votes
10 answers
25k views

Is there a “reverse incremental search” functionality in Fish similar to Bash’s CTRL+R?

I’m really impressed with Fish’s autocomplete functionality. However there is one feature in Bash that I’m unable to find in Fish. When you press Ctrl+R in Bash and begin to type out a term, a search ...
user784637's user avatar
  • 2,065
50 votes
7 answers
20k views

What is the equivalent of bash's !$ and !! in the fish shell?

I've been using bash for a decade or so and have gotten used to being able to type !$ to repeat the last argument, e.g.: $ mkdir foo $ cd !$ cd foo (That last line is printed by the shell to tell ...
Frank Schmitt's user avatar
47 votes
10 answers
41k views

re-use '~/.profile` for Fish?

(I'm talking about the shell Fish, esp. Fish's Fish.) For Bash/ZSH, I had ~/.profile with some exports, aliases and other stuff. I don't want to have a separate config for environment variables for ...
Albert's user avatar
  • 6,681
44 votes
6 answers
29k views

How to remove a path from $PATH variable in fish?

I am using fish as my shell in Debian and recently (after some upgrade) whenever I try to use command completion I have: set: No such file or directory set: Could not add component /usr/lib/x86_64-...
tomekK's user avatar
  • 541
24 votes
2 answers
17k views

Why am I having / how can I fix this error: "shell_session_update: command not found"

Background I am getting into Ruby 2.x, and Rails 4.x, on a MacBook using OS X El Capitan (10.11.3), using the fish shell, employing the integration listed on this page: RVM - Fish Shell (Integration) ...
Pysis's user avatar
  • 1,100
22 votes
3 answers
16k views

How do I change EDITOR to be Pico in fish shell?

I can’t get Mercurial (hg) to use pico as my EDITOR when I’m using fish shell. I’ve tried using this and other variations, but nothing seems to help: set -U EDITOR pico hg commit will always open ...
Petteri Kamppuri's user avatar
21 votes
1 answer
14k views

How to keep terminal window title in sync with tmux window

I am using a program called "Timing" to track my time. Timing uses the name of the current window in iTerm for categorization purposes. I'd like to set the current title of iTerm to match the name of ...
thekevinscott's user avatar
21 votes
2 answers
20k views

Is there a way to "source" a sh script from the fish shell?

I like to put many of my environment variable definitions in the .profile script. If I am using a POSIX-compatible interactive shell like bash, I can use the source command to re-export the ...
hugomg's user avatar
  • 669
19 votes
4 answers
8k views

sudo keeps asking me for my password in fish shell

sudo in Ubuntu keeps asking me for my password for every command. Previously, I only had to enter the password once, and then it would be remembered for a period of time. This recently changed, ...
endolith's user avatar
  • 7,561
18 votes
3 answers
11k views

How to run a command in background with no output unless there's an error

How to suppress a command's output but show it if the command exit codes an error?
Xster's user avatar
  • 2,905
18 votes
3 answers
17k views

How to do command substitution in fish shell?

How would a Bash (or other POSIX shell) command like this have to be expressed in fish? ls -l $(which vim) # or ls -l `which vim`
Raffael's user avatar
  • 1,221
17 votes
3 answers
12k views

How to use fish shell in cygwin?

Is it possible to use the fish shell with cygwin? I wasn't able to compile the source in cygwin, and I didn't find any precompiled packages. Is there a good reason for not having fish in cygwin?
muriloq's user avatar
  • 597
17 votes
5 answers
21k views

How do you "source" a file in fish?

I'd like to use keychain with the fish shell, but I'm not sure how to get fish to load the ~/.keychain/hostname-fish file to set the appropriate environment variables. In bash, there's the "source" ...
Lorin Hochstein's user avatar
17 votes
3 answers
8k views

Make bash as close to fish as possible

I love the fish shell and use it exclusively in MacOS but I use bash everywhere else because its the only thing installed. Having felt the pain of maintaining configuration files for the two shells, I'...
gnzlbg's user avatar
  • 271
15 votes
3 answers
21k views

How do I install/make a custom prompt for fish shell?

I'm using fish 2.0 on Linux, but this might be an installation error, since my ~/.config/fish/config.fish is empty.
SuperCheezGi's user avatar
15 votes
2 answers
2k views

Bind shift-tab to complete-backward in fish

I found myself using the auto-complete functionality of the fish-shell, where pressing tab twice or more cycles through the suggestions. But then I accidentaly pressed tab once to many, and I wanted ...
Sebastian's user avatar
  • 473
11 votes
3 answers
10k views

How to get Fish shell and NVM both installed with Homebrew to work together?

I am trying to manage my packages for OSX using Homebrew as much a I can. I have installed both the Fish Shell and NVM using Homebrew but cannot get Fish to recognize my NVM installation. NVM ...
Sam's user avatar
  • 121
11 votes
7 answers
9k views

Add abbreviations in fish config

I would like to use the abbreviations feature of the fish shell, especially for the known bash variable !! or aliases to common git commands. I know that abbreviations can be added like in the ...
Daniel Rotter's user avatar
11 votes
3 answers
19k views

Reuse .bash_profile for Fish in Mac

I'm using iTerm on my Mac and I have a .bash_profile that I have been comfortably using. I recently got to know about fish bash and I installed it on my Mac and all of a sudden my .bash_profile is not ...
joesan's user avatar
  • 221
10 votes
1 answer
7k views

Where does fish_config save its settings?

I've used the fish_config utility to customize my syntax color scheme and now I want to copy these settings to remote servers I can't run fish_config on. Where does it save the changes made through ...
donut's user avatar
  • 1,026
10 votes
3 answers
5k views

$PATH is driving me nuts

OK, apologies if this is something dumb, but I'm running out of ideas. Goal: prepend /usr/local/bin to $PATH Problem: $PATH won't do what I want or expect How I got here: I want to start learning ...
Chris4d's user avatar
  • 231
7 votes
1 answer
6k views

Right and fast way to test git directory and git branch?

While trying to set up my new fish shell prompt, I ended up testing ways to get the branch name and also testing if I was on a git repository. I have found (1) git rev-parse --abbrev-ref HEAD, (2) git ...
Andrés Botero's user avatar
7 votes
1 answer
2k views

Why is it not recommended to set the default shell of the root user to a non-POSIX shell?

I am going to change my root’s default shell from bash to fish. As far as I know, fish is a not a POSIX standard shell. On the other hand, maybe the kernel or other things in the system have a ...
Cy8099's user avatar
  • 193
6 votes
1 answer
878 views

Fish Shell - can't find where "la" is defined as "ls -la"

On both my Mac and Ubuntu when I type "la" in Fish Shell I receive output identical to that from "ls -la". I thought I might have defined it as a function. However, I can not find "la" being defined ...
rkv's user avatar
  • 63
6 votes
2 answers
2k views

Where is the best place to add an “ssh-add” command in fish shell startup?

At some point I added an ssh-add invocation to my config.fish file. So every time I open a terminal, that runs for a couple of seconds. Is there a better place to set this, so that it runs upon login? ...
tom's user avatar
  • 201
6 votes
1 answer
3k views

What's the easiest way to prepend the current time to the fish prompt?

I'd like to see the current time in my fish prompt so that I can always see for example when I started the last command. I don't want to install extensions.
Suzana's user avatar
  • 319
6 votes
2 answers
2k views

Fish terminal + iTerm, only run shell integration if terminal is iTerm

iTerm has a shell integration script that enables some fancy features, as in having the ability to scroll up to last prompt (in case if there was a lot of stdout i.e. when compiling some code). ...
Adnan Y's user avatar
  • 231
6 votes
2 answers
1k views

How can I ask `fish` to enumerate all the locations it's reading configuration from?

When I start fish, I'd like it to print every location it's reading configuration, profiles, and customizations from, so that I can: understand which specific paths I need to backup if I want to ...
John Feminella's user avatar
5 votes
3 answers
13k views

how to run ssh-agent in fish shell?

I was running eval `ssh-agent -s\` I get this error fish: Unknown command: `ssh-agent
Shriman Keshri's user avatar
5 votes
2 answers
2k views

Go-lang go tool works with Bash but not Fish

For those of you who have no idea what Fish is: http://fishshell.com/ Similarly, if you are not familiar with a Go coding environment and still wish to try and figure out this small puzzle, here is ...
Logan's user avatar
  • 220
5 votes
5 answers
4k views

fish control-left control-right keybindings

I'm using terminator along with fish and I want to use Alt-Left etc for navigating terminator and Ctrl-Left and Ctrl-right to move the cursor by word. The problem is when I do bind \cleft backward-...
Isaac Gomez's user avatar
5 votes
2 answers
4k views

How can I do string manipulation in fish shell

How can I do bash style string manipulations in Fish shell? Specifically, in bash read branch < ".git/HEAD" branch=${branch#ref: refs/heads/} will put the branch name in $branch variable. How ...
blackwing's user avatar
  • 621
5 votes
1 answer
3k views

Using MacPorts within FISH shell

I have been playing around with FISH for a few days and I just tried to switch it to my main shell. That worked fine but now none of my software from MacPorts is recognized. I installed and followed ...
Ley Missailidis's user avatar
5 votes
2 answers
901 views

How to split a string (of arguments) in fish?

I want to split "-r --run" into "-r" and "--run" for string split " " "-r --run" I get string split: -r --run: unknown option` as an error It is ...
RHOOPH's user avatar
  • 123
5 votes
1 answer
2k views

How to combine the output of multiple commands in fish?

Say I want to send the output of to commands into another. cat a.txt && ls I can do this: fish -c "cat a.txt && ls" | another_command But it seems clunky, is there a way to do this ...
ideasman42's user avatar
5 votes
2 answers
9k views

How to set a specific version of Java as JAVA_HOME in Fish in macOS

I was using Bash as my default shell on macOS but I decided to switch to Fish. I am trying to switch between different versions of Java. In bash it was done using the ~/.bash_profile export ...
kmb's user avatar
  • 175
5 votes
2 answers
6k views

Change prompt on command line?

My prompt is quite verbose - which is good most of the time - but now I would like to switch it temporarily because I want to make a screen shot of the terminal. For that purpose I would prefer not to ...
Raffael's user avatar
  • 1,221
5 votes
1 answer
8k views

How do I get fish shell prompt to show the hostname?

I'm attempting to make my Fish prompt look like the old Gentoo shell did. user@hostname ~ % where the user@hostname is green, and the $PWD and symbol were blue. Right now it only shows: user@ ~ %, ...
longviewbits's user avatar
5 votes
1 answer
3k views

"set -xe" in fish shell

In bash, invoking set -x at the beginning of a script causes the commands to be printed on stdout while the script is executing. What's the equivalent syntax for the fish shell?
Sridhar Ratnakumar's user avatar
4 votes
1 answer
3k views

How to expand aliases in fish shell?

In bash you can expand an alias you type. For example if I have an alias cmd="cd ~/user", typing in cmd and then hitting Ctrl+Alt+e would change it to cd ~/user. Is there a way to do this with fish?
user3927950's user avatar
4 votes
3 answers
17k views

Running the output of `ssh-agent` in fish; what does `setenv` do?

When I want to start (or restart) ssh-agent, it gives me a few commands that I should run by doing eval $(ssh-agent). Of course this fails for fish, since it gives syntax for bash or csh. The ...
askewchan's user avatar
  • 171
4 votes
1 answer
3k views

When default shell is not bash-compatible, why do bash scripts not work well?

My default shell is fish, because it's a lot nicer. But often when I run scripts, I get errors that seem to be from the bash script being processed by fish. I think this is because the script writer ...
endolith's user avatar
  • 7,561
4 votes
1 answer
3k views

/bin/bash shell (macOS) throwing `-bash: declare: -A: invalid option` error message at shell start

I briefly changed my default shell on macOS Catalina (10.15.1) to Fish, following the steps in Fish's documentation. First, I executed > echo /usr/local/bin/fish | sudo tee -a /etc/shells followed ...
thrillifying's user avatar
4 votes
2 answers
1k views

No colors in weechat, tig, htop, ranger, etc

I noticed that on my Mac I don't have any colors in e.g., tig, weechat, htop or ranger. On my linux I do. It happens in all terminal apps I have (alacritty, iterm and Terminal.app), in zsh, fish and ...
Vey's user avatar
  • 171
4 votes
1 answer
951 views

In fish shell, which command is equivalent to bash's compgen?

compgen is a useful command, and fish is an excellent command shell. But I cannot find an equivalent in fish. I write one by myself: function compgen --description 'Print a list of documented fish ...
TorosFanny's user avatar
4 votes
1 answer
1k views

Quote or bracket completion in bash, without pressing TAB

Is there any way to have bash autocomplete matching symbols like '"[{( with their right handed counterparts? I would like to do this without having to press tab. For example typing the string echo " ...
codysehl's user avatar
  • 348
3 votes
3 answers
6k views

How do I set the title of Terminal.app with the fish shell?

I'm trying the fish shell in Mac OS X, intalled using MacPorts. I'd like to have the title of my Terminal window be my current directory. Currently, the title just says Terminal - fish - 80x24 ...
Lorin Hochstein's user avatar
3 votes
2 answers
3k views

Execute two or more commands simultaneously in shell script

It is often very helpful to run commands in parallel in a shell script, but I cannot find ways to do it. Is this possible? If so, how would I achieve that? I'm mainly interested in doing that for fish....
Joy Jin's user avatar
  • 175