How do I check my bash version?

How do I check my bash shell version running on a Linux or Unix like operating systems? Many bash tutorial says that you need bash version 4.x or above. How do I find the version of bash I am running on macOS desktop or Ubuntu Linux server?

Introduction – Knowing bash version can help to see if the specific feature will work with your system or not. This page shows how to check or find out your bash shell version running on a *BSD, Linux, macOS, and Unix-like operating systems.

ADVERTISEMENTS

How do I find the version of bash I am running?

To find my bash version, run any one of the following command:

  1. Get the version of bash I am running, type: echo "${BASH_VERSION}"
  2. Check my bash version on Linux by running: bash --version
  3. To display bash shell version press Ctrl+x Ctrl+v

Check my bash version using ${BASH_VERSION} shell variable

Type echo command or printf command:

echo "BASH_VERSION"
printf "%s\n" $BASH_VERSION

Find bash shell version using the --version option

Just pass the --version to the bash command to show version information for this instance of bash shell on the screen and exit successfully:

bash --version
echo $?
How do I find the version of bash I am running on Linux or Unix or macOS

How to check Bash version

Display version information about the current instance of bash using keyboard shortcut

Just press CTRL + x followed by CTRL + v and you should see something as follows on screen:

GNU bash, version 4.4.19(1)-release (x86_64-pc-linux-gnu)

Use package manger to find out bash version

Use the dnf command on a Fedora Linux and yum command on a CentOS/RHEL to get version info about bash package:
$ yum info bash

How to check bash version on Linux

How to check bash version on a CentOS Linux using yum command

How to check Bash version on Debian or Ubuntu Linux

Debian/Ubuntu Linux user try the apt command or apt-cache command or dpkg command as follows:
$ apt info bash
OR
$ apt-cache show bash

How to get bash version number on Unix or Linux

How to get bash version number using a package manager

Conclusion

This page showed you various commands on how to check bash version on your Linux or Unix-like operating system.

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
6 comments… add one
  • Tom Apr 12, 2004 @ 13:12

    Another option:

    bash -v
    • Sayali Apr 12, 2005 @ 3:14

      That is stupid. The -v prints shell input lines as they are read. Use the --version:
      bash --version

  • Linux Fan Boi Oct 12, 2007 @ 1:42

    I am using:

    #!/bin/bash
    echo "My Bash shell version is $BASH_VERSION"

    It might help someone.

  • John Apr 23, 2014 @ 12:49

    It is 2014 and I just wanna say thank you for this page.

    • SW_DEV Aug 14, 2015 @ 19:18

      +1

      • Mustafa Dec 23, 2017 @ 1:13

        Add my vote too in 2017.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.