Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Install Fish with Ubuntu’s package manager, verify the executable, and try it with fish before changing your account. Keep your settings in ~/.config/fish/config.fish, use Fish’s own syntax for variables and paths, and change the SSH login shell only after you have tested a recovery path. This order gives you Fish’s interactive features without risking an inaccessible VPS.

What you are changing on the VPS

Fish is an interactive command shell. It provides its own command-line experience, including autosuggestions, while using a configuration model and language that differ from Bash. Installing the package does not change how your account logs in, and starting fish manually does not alter existing scripts or system services.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

There are two separate decisions:

  • Use Fish interactively: run fish when you want its interface, then return to the parent shell with exit.
  • Use Fish as the login shell: change the account setting with chsh. New terminal and SSH logins will start Fish automatically.

The second choice is optional. It can expose PATH or compatibility issues because some login environments expect a Bourne-compatible shell that reads files such as /etc/profile. Fish’s documentation warns: “Setting fish as your login shell may cause issues, such as an incorrect PATH.” Test a new connection while your original SSH session remains open.

Before you install

Access and privileges

Connect to the VPS over SSH with the account you intend to use. That account needs permission to run sudo for package installation and for adding Fish to the system’s approved login-shell list. If you do not have sudo, install Fish through the VPS administrator or use an account that does.

Keep a recovery session

Do not close your working SSH connection when you later change the login shell. Keep it available so you can restore Bash if the new shell starts with a broken PATH, a configuration error, or a tool that expects a different startup environment.

Install Fish from Ubuntu’s package manager

1. Refresh package metadata

Run this first so APT has current package information for the Ubuntu release installed on your VPS:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
sudo apt update

2. Install the distribution package

Install Fish with:

sudo apt install fish

Accept the package prompt if APT asks for confirmation. The Ubuntu package is the sensible default because its availability and integration follow your distribution’s release stream.

Optional: use the Fish project’s Ubuntu PPA

The Fish project also documents a release PPA route:

sudo apt-add-repository ppa:fish-shell/release-4
sudo apt update
sudo apt install fish

Use this route only when you have a specific reason to follow the project’s PPA rather than Ubuntu’s package. Package versions and support can vary by Ubuntu release, so do not add the PPA merely because it exists.

Verify the installation before changing anything

Confirm which executable your account will use:

command -v fish

A successful result is an absolute path, such as /usr/bin/fish. Record that path; you will use the exact value when approving and selecting Fish as a login shell.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check the installed version as well:

fish --version

If either command fails, Fish is not available to your current PATH. Recheck the APT install output and package metadata before attempting chsh. Do not change the account’s shell until command -v fish returns a usable path.

Try Fish without making it your login shell

Start a temporary Fish session from your current shell:

fish

You can now test commands, completion, prompts, and your terminal workflow. This does not change the shell used the next time you connect. Leave the temporary session with:

exit

The exit command returns you to the parent shell. This install-first, try-first workflow is the safest way to discover whether your tools and habits work as expected.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Understand Fish’s configuration files

Per-user startup file

Fish reads the per-user startup file at:

~/.config/fish/config.fish

Create the directory and file if they do not exist:

mkdir -p ~/.config/fish
touch ~/.config/fish/config.fish

Use config.fish for settings that should apply to your Fish sessions. Fish reads it when Fish starts; it is not a Bash startup file and it does not get interpreted by Bash.

Small startup snippets with conf.d

Fish automatically executes .fish snippets in:

~/.config/fish/conf.d/

These snippets run before config.fish. They are useful when you want separate, focused files instead of one large configuration. For example, you can keep a path-related snippet separate from aliases or prompt settings. Keep each file’s content in Fish syntax and use a .fish extension.

Limit settings to the right session type

Use Fish’s status checks when a setting belongs only to login sessions or only to interactive sessions. The available checks are:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
status --is-login
status --is-interactive

A login-only PATH example is:

if status --is-login
    set -gx PATH $PATH ~/linux/bin
end

status --is-login prevents that block from running in non-login Fish sessions. Add an interactive check when a command should exist only for an interactive terminal, rather than for scripts or other non-interactive invocations.

Use Fish syntax for PATH and variables

Fish does not use Bash’s startup syntax. In particular, do not paste a Bash assignment such as export PATH=... into config.fish. Fish has its own set command and path-handling rules.

Prefer fish_add_path for repeatable path changes

For an idempotent path addition, use:

fish_add_path ~/linux/bin

This form is designed for Fish’s path management and avoids repeatedly appending the same directory every time a shell starts. Place it in config.fish when the directory should be available in your Fish sessions.

Choose variable scope deliberately

The login-only example uses set -gx: -g makes the variable global to the Fish process, and -x exports it to programs started from Fish. Keep the scope appropriate to the setting. A path needed by every Fish session can be configured globally; a value intended only for a particular invocation should not be made universal accidentally.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Fish also supports universal variables. They persist across Fish sessions and are set with set -U. For example:

set -U EDITOR vim

Universal variables are convenient for preferences, but use them deliberately: a universal setting can affect every Fish instance for that user, not just the terminal where you typed it.

For syntax details and examples of functions and variables, see the Fish tutorial.

Define reusable Fish functions

Fish functions can be stored as files in:

~/.config/fish/functions

A function file gives you a reusable command without putting all of its logic in config.fish. The Fish tutorial illustrates an ll function that wraps ls -lh. A simple interactive definition is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
function ll
    ls -lh
end

Save persistent functions under the functions directory so Fish can load them when needed. Keep function definitions in Fish syntax; Bash function declarations copied into these files will not work.

Make Fish the default shell for SSH (optional)

Only do this after the temporary test and configuration steps work. Changing the login shell affects terminal logins, including SSH, but it does not rewrite your existing scripts.

1. Locate Fish again

command -v fish

Use the exact path returned by this command. In the examples below, the command substitution obtains that path automatically.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

2. Approve the executable as a login shell

Append the Fish path to /etc/shells:

command -v fish | sudo tee -a /etc/shells

The file lists shells that the system permits for login use. If the path is already present, avoid adding needless duplicate lines; the important requirement is that the exact installed path appears in the approved list.

3. Change the current account’s login shell

chsh -s "$(command -v fish)"

Depending on the VPS image, chsh may ask for your account password. The command changes the account setting; it does not retroactively convert the shell in your current SSH process.

4. Open a new SSH connection

Leave the original session open, start a separate SSH connection, and check that Fish starts as expected. Run:

command -v fish
fish --version

Then inspect your PATH and try the commands you use for administration. Testing a fresh connection matters because login startup behavior is different from launching Fish manually inside an existing shell.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What changes when Fish becomes the login shell

The login-shell choice affects the interactive environment presented at SSH login. Fish reads its own configuration files, while some systems and administration procedures assume a Bourne-style shell that reads /etc/profile. That difference can leave PATH entries missing or cause startup commands written for Bash to fail.

Area Keep Bash as login shell Use Fish as login shell
Interactive experience Uses Bash’s established command-line behavior. Provides Fish’s interactive features, including autosuggestions.
Configuration syntax Uses Bash or POSIX-style startup syntax. Uses config.fish, conf.d, Fish variables, and Fish functions.
PATH and environment Reads the startup conventions expected by Bourne-compatible tooling. Requires Fish-compatible PATH configuration; an incorrect PATH is the documented risk.
Scripts and tooling Matches environments that expect a Bourne-compatible login shell. Interactive login changes, but existing scripts keep their declared interpreter.
Recovery over SSH Remains the compatibility fallback. Requires a still-open session or console access if startup configuration prevents a usable login.

There is no requirement to choose one shell for every task. Many administrators use Fish for interactive work while retaining Bash for scripts or compatibility-sensitive environments.

Keep scripts independent from your interactive shell

Changing your account’s login shell does not convert Bash or POSIX scripts to Fish. A script should name the interpreter it requires with a shebang. When a script is executed without an explicit interpreter, the shebang identifies which interpreter should run it.

To run a Fish script explicitly, use:

fish /path/to/script

Keep scripts that depend on Bourne syntax under their intended interpreter rather than translating them simply because your interactive login now starts Fish. Conversely, run Fish-language scripts with Fish so their syntax is interpreted correctly.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Rollback if the new login shell causes trouble

Restore Bash

From the still-open recovery session, set Bash as the login shell:

chsh -s /bin/bash

Use the actual Bash path present on your VPS, and confirm that it appears in /etc/shells. Then open another SSH connection to verify that the account returns to the expected environment.

When rollback is necessary

  • Your new SSH session starts with a missing or unusable PATH.
  • Startup files contain Bash syntax and Fish exits or reports errors while loading them.
  • A management command or automation tool expects a Bourne-compatible login shell.
  • You cannot reliably run routine administration commands after login.

Rollback changes only the account’s login-shell selection. Fish remains installed, so you can continue launching it temporarily with fish while you correct the configuration.

Troubleshoot common installation and login problems

APT cannot find or install Fish

Run sudo apt update again and read the package-manager error for the Ubuntu release and repositories in use. If you intentionally need the Fish project’s release stream, follow the documented PPA commands, then refresh metadata before installing. Do not proceed to chsh until command -v fish succeeds.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

fish starts, but a command is missing

Check the effective PATH in the Fish session and compare it with the directories your tools require. Add user directories with fish_add_path or, when appropriate, the login-only set -gx PATH ... block. Avoid Bash’s export PATH=... syntax in Fish files.

Fish reports an error while reading configuration

Temporarily move the newest change out of config.fish or its conf.d snippet, start Fish again, and reintroduce the setting using Fish syntax. Keep startup files small enough that you can identify which block caused the error.

SSH still opens the old shell

Existing sessions keep their original process. Close only the test connection, open a genuinely new SSH connection, and check the shell path and version. If the new session still uses the old shell, verify that chsh completed for the intended account and that the Fish executable path is listed in /etc/shells.

The account becomes difficult to use after the change

Use the original SSH session or the VPS provider’s console to run chsh -s /bin/bash. Confirm the Bash path and reconnect. Once access is restored, inspect Fish’s configuration and PATH before trying Fish as the login shell again.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A repeatable installation checklist

  1. Connect over SSH with an account that can use sudo.
  2. Run sudo apt update.
  3. Run sudo apt install fish.
  4. Verify with command -v fish and fish --version.
  5. Start a temporary session with fish, then leave it with exit.
  6. Create ~/.config/fish/config.fish and use Fish syntax for settings.
  7. Use ~/.config/fish/conf.d/ for separate startup snippets and ~/.config/fish/functions for saved functions.
  8. Add paths with fish_add_path or a correctly scoped set -gx PATH block.
  9. Keep a recovery SSH session open before changing the login shell.
  10. If desired, add the exact Fish path to /etc/shells, run chsh -s "$(command -v fish)", and test a new connection.
  11. Roll back with chsh -s /bin/bash if PATH or compatibility problems prevent normal administration.

Which setup is right for an Ubuntu VPS?

Install Fish for its interactive experience when you are comfortable maintaining Fish configuration and checking PATH behavior. Leave Bash as the login shell when compatibility with existing startup files, management tooling, or automation is more important than making Fish automatic at SSH login. You can still launch Fish on demand, so installing it does not force an all-or-nothing decision.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.