Skip to main content
64 votes

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

The 'fish' way of setting the $PATH variable is to actually use set --universal fish_user_paths $fish_user_paths /new/path/here. Then $fish_user_paths is actually prepended to the $PATH variable when ...
Elijah Lynn's user avatar
  • 1,524
39 votes
Accepted

How to keep terminal window title in sync with tmux window

First thing to point out is that you can do this via tmux completely independent of your shell. Add the following to your ~/.tmux.conf; for example: set-option -g set-titles on set-option -g set-...
Kurtis Rader's user avatar
  • 1,547
36 votes
Accepted

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

For sourcing a general sh script in fish, one option is the bass plugin, which can source a bash script's environment variables into fish. If you have fisherman, you can install it with fisher install ...
Elliott Beach's user avatar
34 votes

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

For a much cleaner solution, you can use the foreign env plugin: fenv source ~/.profile
jgillich's user avatar
  • 1,050
27 votes

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

There is no simple way to obtain syntax highlighting in GNU Bash (or GNU Readline), but it is in principle possible to implement your own line editor in Bash script by binding all the user inputs to ...
akinomyoga's user avatar
25 votes

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

As Elijah says, best practice is to modify the fish_user_paths rather than the global PATH. To avoid ever having to Google this again… Create a couple of functions that only modify fish_user_paths ...
clozach's user avatar
  • 1,143
19 votes
Accepted

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

The logical operators you're used to, are supported since fish 3.0.0, released on 2018-12-28. From the v3 release notes: fish now supports && (like and), || (like or), and ! (like not), ...
Dennis's user avatar
  • 462
15 votes

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

For sudo !! In fish shell (release 3.1b1 and later) you can use the binding __fish_prepend_sudo, which is Alt+S by default, to prepend the currently present command-line with sudo : $ make sandwich▎ ...
jnns's user avatar
  • 251
14 votes

Add abbreviations in fish config

Sorry, I'm not sure if I understand what you're asking. But if your question is how to set your abbr definitions on startup (and in a file that you can store in a repository and share between machines)...
MJV's user avatar
  • 241
12 votes

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

This FAQ suggests adding set -gx EDITOR pico to ~/.config/fish/config.fish
Marco Maldonado's user avatar
12 votes
Accepted

Where does fish_config save its settings?

Some settings, such as the color theme, are stored as universal variables. Run set -U to see them. Note that at the moment universal variables are stored in a file whose name is unique to each host. ...
Kurtis Rader's user avatar
  • 1,547
10 votes

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

You can use bass, a plugin to execute bash commands in fish. Install bass. $ git clone https://github.com/edc/bass.git $ cd bass $ make install And then, just put this in your config.fish: bass ...
rsalmei's user avatar
  • 201
10 votes
Accepted

Reuse .bash_profile for Fish in Mac

Fish has exactly one user controlled config file which is named $HOME/.config/fish/config.fish by default. Fish also has an export command for compatibility with bash/zsh/sh but it just a thin wrapper ...
Kurtis Rader's user avatar
  • 1,547
10 votes

how to run ssh-agent in fish shell?

There are two parts to your question: Why do you get an error when attempting eval `ssh-agent -s` ? How to enable ssh-agent in the Fish shell For the first, the feature you are looking for is called ...
NotTheDr01ds's user avatar
  • 23.6k
8 votes

Make bash as close to fish as possible

There are many options for configuring bash. I use the following commands to give easy command history access:- bind '"\e[A": history-search-backward' bind '"\e[B": history-search-forward' These set ...
AFH's user avatar
  • 17.7k
7 votes
Accepted

How to expand aliases in fish shell?

In fish the alias command just creates a trivial function. For example, alias cmd 'cd ~/user' Is simply shorthand for function cmd cd ~/user end Because it's a function in fish you can't expand ...
Kurtis Rader's user avatar
  • 1,547
7 votes
Accepted

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

While I am not deeply familiar with Fish, based on what I am reading it seems like the issue is with the backticks in your command: /usr/libexec/java_home -v 1.7 You see that is just like this in ...
Giacomo1968's user avatar
  • 56.1k
6 votes

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

Now in fish shell 3.6.0 https://github.com/fish-shell/fish-shell/releases/tag/3.6.0 By default, Control-R now opens the command history in the pager (#602). This is fully searchable and syntax-...
AsukaMinato's user avatar
6 votes

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

I had the same problem as you, and I fixed by using oh-my-fish (it's a plugin manager for fish shell) https://github.com/oh-my-fish/oh-my-fish. You can install it with this command : curl -L https:...
Sidahmed's user avatar
  • 377
6 votes

How can I do string manipulation in fish shell

The fish shell now has a string builtin command. To use string instead of sed in your case: set branch (string replace 'ref: refs/heads/' '' <.git/HEAD) It can operate on given arguments, or on ...
MattH's user avatar
  • 554
6 votes
Accepted

Difference between set -g and set -x

No, they do not all do the same thing. The -x flag is orthogonal to the -g, -l, and -u flags. The former simply sets the export attribute on the var. The latter three set the scope of the var. You can ...
Kurtis Rader's user avatar
  • 1,547
6 votes
Accepted

How to combine the output of multiple commands in fish?

use a begin...end block begin; cat a.txt; ls; end | another_command or with whitespace begin cat a.txt ls end | another_command
glenn jackman's user avatar
6 votes
Accepted

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

The type command is your friend for this type of question: $ type la la is a function with definition # Defined in /usr/local/share/fish/functions/la.fish @ line 4 function la --description 'List ...
Kurtis Rader's user avatar
  • 1,547
6 votes

Execute two or more commands simultaneously in shell script

The most basic approach is with &, this other answer is right. It also advocates nohup but nohup redirects stdin, stdout and stderr, something you may or may not want. Read Difference between ...
Kamil Maciorowski's user avatar
6 votes

how to run ssh-agent in fish shell?

I get this solution run eval (ssh-agent -c) reference:https://wiki.archlinux.org/title/Fish#Evaluate_ssh-agent
Shriman Keshri's user avatar
5 votes

How do you "source" a file in fish?

Use the source command: source filename.txt source may not have existed originally but it exists now and the . alias in fish is officially deprecated. From man . in fish 3.6.1: . (a single period) ...
Elijah Lynn's user avatar
  • 1,524
5 votes

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

Far better Ctrl+r reverse searches with FZF and fzf fish plugin, using the Triton fish package manager, configured to use The Silver Searcher. ~/.config/fish/config.fish: triton jethrokuan/fzf set -...
Duke's user avatar
  • 151
5 votes

Reuse .bash_profile for Fish in Mac

You can use this script by overtrue: [gist link] It basically parses .bash_profile and sets the same environment variables in Fish. Works great for me! # Fish shell egrep "^export " ~/.bash_profile ...
Pavel Alexeev's user avatar
5 votes

Make bash as close to fish as possible

Regarding auto-completion, bash uses GNU Readline to provide tab-completion, and history lookup & completion. Tab completion works for command names, files, and — for any commands which have ...
jpaugh's user avatar
  • 1,390
5 votes
Accepted

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

In ~/.config/fish/functions there is a file named fish_prompt.fish. Replace the line echo -n (prompt_pwd) with echo -n (date +%H:%M) (prompt_pwd) Result:
Suzana's user avatar
  • 319

Only top scored, non community-wiki answers of a minimum length are eligible