Know Bash shell version command


To know the version of bash that is available on your device make use of --version option along with the bash.

Example:
$ bash --version

GNU bash, version 3.2.57(1)-release (arm64-apple-darwin21)
Copyright (C) 2007 Free Software Foundation, Inc.

You do not need to be on the bash shell in order to know the version, in the below example the same command works on the zsh or sh shell as well.

% bash --version

GNU bash, version 3.2.57(1)-release (arm64-apple-darwin21)
Copyright (C) 2007 Free Software Foundation, Inc.




% sh

sh-3.2$ bash --version

GNU bash, version 3.2.57(1)-release (arm64-apple-darwin21)
Copyright (C) 2007 Free Software Foundation, Inc.
sh-3.2$ 

You would get a command not found error if you use single dash with version option!

$ -version
-version
bash: -version: command not found
Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap