πŸ”Ή 1. Bash Introduction & Setup
Estimated reading: 4 minutes 412 views

🐚 Bash Version & Installation – Check, Update, and Install Bash on Linux


Introduction to Bash Version & Installation – How to Check and Install Bash in Linux

Bash (Bourne Again Shell) serves as the default shell for most Linux distributions, providing robust command-line functionality and advanced scripting capabilities. But not all systems come with the latest version, and sometimes you may need to check, install, or upgrade Bash manually.

In this guide, you’ll learn how to check your current Bash version, install Bash, and upgrade it across popular Linux distributions like Ubuntu, CentOS, Fedora, and Arch.


In this article, you’ll learn:

  • How to verify the Bash version currently installed on your system
  • Steps to install Bash on Linux, macOS, or Windows Subsystem for Linux (WSL)
  • How to upgrade Bash to the latest available version
  • Common package managers and commands used for Bash installation

How to Check Bash Version

To see which version of Bash is installed, use this command:

bash --version

Sample Output:

GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2020 Free Software Foundation, Inc.
  • The first number (5.1.16) is the version.
  • If the version is below 4.x, consider updating for security and feature reasons.

How to Install Bash (Linux Distributions)

On Ubuntu / Debian:

sudo apt update
sudo apt install bash

On CentOS / RHEL:

sudo yum install bash

Or for RHEL 8+:

sudo dnf install bash

On Fedora:

sudo dnf install bash

On Arch Linux / Manjaro:

sudo pacman -S bash

Most systems already have Bash pre-installed. You can reinstall or upgrade if needed.


How to Set Bash as the Default Shell

After installation, you can make Bash the default shell with:

chsh -s /bin/bash

To verify:

echo $SHELL

You might need to log out and back in for changes to take effect.


How to Update Bash to the Latest Version

Ubuntu/Debian (Using APT):

sudo apt update
sudo apt upgrade bash

Build From Source (for the latest release):

cd /usr/local/src
sudo wget https://ftp.gnu.org/gnu/bash/bash-5.2.tar.gz
sudo tar -xvzf bash-5.2.tar.gz
cd bash-5.2
sudo ./configure
sudo make
sudo make install

After install:

bash --version

This method gives you the latest release not tied to your distro’s package manager.


Install Bash on macOS or Windows (WSL)

macOS (using Homebrew):

brew install bash

To switch to the new Bash:

chsh -s /usr/local/bin/bash

Windows (via WSL):

  1. Enable Windows Subsystem for Linux
  2. Install Ubuntu from the Microsoft Store
  3. Open Ubuntu terminal – Bash is pre-installed
bash --version

Summary – Bash Version & Installation

Bash is an essential tool for Linux users. Knowing how to check, install, and update it ensures you’re using the most secure and feature-rich version. From Linux to macOS and Windows WSL, Bash is available on every major platform.

Key Takeaways:

  • Use bash --version to check your version
  • Bash is usually pre-installed, but can be upgraded
  • Build from source for the latest Bash release
  • Use chsh to make Bash your default shell

Use Cases:

  • Scripting automation with latest features
  • Better compatibility with modern Linux tools
  • Using Bash on cross-platform environments (macOS/WSL)

FAQ – Bash Version & Installation


How do I check if Bash is installed?
Use this command:

which bash

If it returns a path like /bin/bash, Bash is installed.


Can I have multiple versions of Bash?
Yes. You can build and install Bash in a custom location (e.g., /usr/local/bin/bash) and choose it selectively.


How do I update Bash on Ubuntu?
Run:

sudo apt update
sudo apt install --only-upgrade bash

Is Bash available on macOS?
Yes, but older macOS versions ship with Bash 3.x. Use Homebrew to install the latest version.


What’s the latest version of Bash?
As of 2025, the latest stable version is Bash 5.2.x, which includes performance, security, and scripting improvements.


Share Now :
Share

🟒 Bash: Bash Version & Installation

Or Copy Link

CONTENTS
Scroll to Top