π 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):
- Enable Windows Subsystem for Linux
- Install Ubuntu from the Microsoft Store
- 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 --versionto check your version
- Bash is usually pre-installed, but can be upgraded
- Build from source for the latest Bash release
- Use chshto 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 :
