Bash (Bourne Again SHell) is the default command line interpreter for most Linux distributions. Knowing the version of Bash running on the system is essential for various reasons, such as understanding which features are available and ensuring compatibility with certain scripts or commands. This tutorial explains how to check Bash version on Linux.
1. bash command
The most straightforward way to determine the Bash version is by using the bash
command with --version
option.
bash --version
The command displays the Bash version installed on the system along with some additional information.
GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2020 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.
2. BASH_VERSION variable
The BASH_VERSION
variable is a convenient and direct way to get the Bash version without having to invoke the external commands.
echo $BASH_VERSION
Output example:
5.1.16(1)-release
Leave a Comment
Cancel reply