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






Author Info:

Rakesh (He/Him) has a Masters Degree in Computer Science with over 15+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap