fish-shell
AWS
Linux
installation
cloud-computing

How do I install Fish Shell on AWS Linux

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

Introduction

On AWS, this usually means installing Fish on an Amazon Linux EC2 instance. The important first step is identifying which Amazon Linux generation you are using, because Amazon Linux 2023 and Amazon Linux 2 use different package-manager workflows.

Check the Operating System Version First

Before installing anything, inspect the OS release information:

bash
cat /etc/os-release

That tells you whether you are running Amazon Linux 2023 or Amazon Linux 2. This matters because Amazon Linux 2023 normally uses dnf, while Amazon Linux 2 is still centered around yum.

If you skip this check and copy random commands from the web, you can easily end up following instructions for the wrong distribution generation.

Installing on Amazon Linux 2023

Amazon Linux 2023 uses dnf, so the installation path is usually simple if the package is available in your configured repositories.

bash
sudo dnf update -y
sudo dnf install -y fish

After the package installs, start Fish for the current session:

bash
fish

That lets you verify the shell works before making any login-shell changes.

Installing on Amazon Linux 2

Amazon Linux 2 usually uses yum. Package availability can be more limited, so older environments often relied on an additional repository path before installing Fish.

bash
sudo yum update -y
sudo amazon-linux-extras install epel -y
sudo yum install -y fish

Whether that repository path is appropriate depends on your instance policy and package sources. The important point is that Amazon Linux 2 may need extra repository setup, while Amazon Linux 2023 often does not.

If the package still is not available, the fallback options are:

  • use an approved extra repository,
  • build Fish from source,
  • or move the instance to a newer distribution if that fits the environment.

Test Fish Before Changing Your Login Shell

On a remote EC2 instance, do not rush into making Fish the default shell. First, launch it manually:

bash
fish

Then leave it with:

bash
exit

This matters on remote servers because a shell misconfiguration can turn into an inconvenient SSH recovery problem. An interactive test session is cheap insurance.

Changing the Default Shell Carefully

If you decide to make Fish your default shell, add it to /etc/shells and then update your login shell.

bash
command -v fish | sudo tee -a /etc/shells
chsh -s "$(command -v fish)"

Do not close the current SSH session immediately. Open a second session first and confirm that login still works as expected. Keeping a fallback session open is standard practice whenever you change a remote login shell.

Basic Fish Configuration

Fish stores user-level configuration under:

text
~/.config/fish/config.fish

A small example:

fish
set -gx EDITOR vim
set -gx PAGER less
alias ll "ls -lah"

Remember that Fish syntax is not the same as Bash syntax. Existing Bash aliases and shell startup snippets may need to be rewritten rather than copied directly.

Common Pitfalls

  • Following Amazon Linux 2 instructions on Amazon Linux 2023 or the reverse.
  • Changing the default shell on a remote EC2 instance before testing Fish interactively.
  • Assuming Bash startup files can be copied directly into Fish configuration.
  • Adding Fish as the login shell without checking that it appears in /etc/shells.
  • Closing the only active SSH session immediately after changing the shell.

Summary

  • Identify the Amazon Linux version first because the package workflow differs between generations.
  • Amazon Linux 2023 typically uses dnf, while Amazon Linux 2 typically uses yum.
  • Install Fish, then test it interactively before changing the default shell.
  • Keep a fallback SSH session open when changing login-shell settings on remote instances.
  • Fish configuration lives in ~/.config/fish/config.fish and uses different syntax from Bash.

Related reading
Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

All Rights Reserved.