How to check Bash version


This article will provide you with the information on how to check bash version on your operating system.

Operating System and Software Versions

  • Operating System: – Distribution Agnostic


No special prerequisites are required is required.


  • # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
  • $ – requires given linux commands to be executed as a regular non-privileged user


Check Bash version using bash command

The easiest way to check bash version number is by executing the shell bash command with --version command option:

$ bash --version
bash --version
GNU bash, version 4.4.18(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later 

From the above command bash command output we ca determine that the system’s bash version number is 4.4.18.

Check Bash version via builtin $BASH_VERSION variable

Another approach on how to check your shell’s bash version is to print the content of shell’s builtin variable $BASH_VERSION.


Check Bash version from within shell script

Using the above builtin $BASH_VERSION variable example it is also possible to use/print bash version from within a bash shell script. Create a new new file called ~/

$ nano ~/

Next, insert the following lines and save:


echo "Checking for Bash version...."
echo "The Bash version is $BASH_VERSION !"

Once ready, make the file executable and run the script:

$ chmod +x 
$ ./ 
Checking for Bash version....
The Bash version is 4.4.18(1)-release !

Comments and Discussions
Linux Forum