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 "%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 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

If you installed bash on FreeBSD, then type:
# pkg info bash
Name           : bash
Version        : 5.0.18_3
Installed on   : Sat Jan  2 22:50:30 2021 IST
Origin         : shells/bash
Architecture   : FreeBSD:12:amd64
Prefix         : /usr/local
Categories     : shells
Licenses       : GPLv3+
Maintainer     :
WWW            :
Comment        : GNU Project's Bourne Again SHell
Options        :
	DOCS           : on
	FDESCFS        : off
	HELP           : on
	NLS            : on
	STATIC         : off
	SYSBASHRC      : off
	SYSLOG         : off
Shared Libs required:
Annotations    :
	FreeBSD_version: 1201000
	cpe            : cpe:2.3:a:gnu:bash:5.0.18:::::freebsd12:x64:3
	repo_type      : binary
	repository     : FreeBSD
Flat size      : 8.48MiB
Description    :
This is GNU Bash.  Bash is the GNU Project's Bourne Again SHell,
a complete implementation of the POSIX.2 shell spec, but also
with interactive command line editing, job control on architectures
that support it, csh-like features such as history substitution and
brace expansion, and a slew of other features.

root@nixcraft-m6700:~ # 


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 Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 7 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig 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 VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
7 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:

    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


      • Mustafa Dec 23, 2017 @ 1:13

        Add my vote too in 2017.

  • Haleema Mar 13, 2021 @ 9:28

    Add my vote in 2021 too.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum