Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

How do I find the version of bash I am running?

Writer Matthew Martinez

(learning bash) I was trying to check the bash version so I typed /bin/bash -v.

That outputted a whole lot of text to the screen (contents of .bashrc, and other files sourced from it).

Could I have screwed up something (like overwriting some config files/setting incorrect environment variables etc.) due to that command?

I also can't find documentation on what the -v switch is for.

3

7 Answers

The -v parameter for bash stands for verbose, and instructs bash to print out as much information as possible about what it is doing. On startup, it will print out all the configuration it is reading in.

To print out the version information for bash, use bash --version.

6

When running bash (e.g. from gnome-terminal) you can check value of BASH_VERSION environment variable.

$ echo $BASH_VERSION
4.2.37(1)-release

If the value is empty, you are not running bash.

5

There's a key shortcut that instructs current shell information to show up:

Ctrl+x Ctrl+v

From man bash

 display-shell-version (C-x C-v) Display version information about the current instance of bash.

This is the best choice if you have messed with environment variables.

No, everything is alright. From man bash:

 --verbose Equivalent to -v.

It is just not as silent as usual. Try

--version 

instead.

The usual --version may give you too much multi-line boilerplate so what I am using is

bash -c 'echo $BASH_VERSION'
5

To only get the version and not the multiline text:

$ bash --version | head -1 | cut -d ' ' -f 4

If you are on Windows and, instead, want to know what version of Git Bash you're running, it is part of Git for Windows.
So the Git Bash version is:

git --version

git version 2.23.0.windows.1

On my same machine when I run:

echo $BASH_VERSION

4.4.23(1)-release

To update to the latest version, generally you will want to download and install the latest version of git for Windows as per FAQ. Settings/customizations should be preserved if installed in the appropriate configuration folders.

3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy