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.

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:

printf "%sn" $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 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 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
$ apt-cache show bash

How to get bash version number using a package manager


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

Posted by: SXI ADMIN

The author is the creator of SXI LLC and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.