Check the version of bash

To find your bash version go in your terminal and echo out the $BASH_VERSION shell variable.

$ echo $BASH_VERSION
5.0.17(1)-release

This $BASH_VERSION shell variable is set as long as you are using bash as your shell variable. So if you are using zsh or fish as a shell environment this variable is not set. In that case you can use the --version flag on the command:

$ bash --version
GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

You can invoke bash as a command like this because bash actually is just another binary program on your system like e.g. cat, nano, tail.

The bash program is located in a folder on your operating system that is included in your PATH. To see where bash is installed you can run the following command:

$ which bash
/usr/bin/bash

As you see, for me the bash program/command is located in a folder called bin, which is inside a folder called usr which is located at the root of my file system.

Some programs show the version info with the flag -v. If you add the -v flag to the bash command bash will run in verbose mode, in this mode bash will show you as much information as possible. You can safely test this out if you like, you will see another shell get launched showing your shell configuration at startup.

See Also

6 Non-Programming Books for Programmers