Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

(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.

share|improve this question
If you ran bash -v you invoked a new bash shell with verbose mode activated, so you will see verbose output for further commands (at the very minimum you'll see printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}"). To end the verbosity, type exit command - you will be back in the original non-verbose bash shell (or whatever shell you were in). – ADTC Apr 5 at 3:24
up vote 84 down vote accepted

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.

share|improve this answer
Great! I also found the list of switches for bash. – Zabba May 2 '11 at 17:21
Alternatively, if you're already running a bash shell, you can output the content of the special BASH_VERSION variable. echo "$BASH_VERSION". There's also a special array (BASH_VERSINFO) containing each version number in separate elements. if ((BASH_VERSINFO[0] < 4)); then echo "Sorry, you need at least bash-4.0 to run this script." >&2; exit 1; fi – geirha May 2 '11 at 20:42
typo, should be something like [ "${BASH_VERSINFO}" -lt 4 ] or [ "${BASH_VERSINFO[0]}" -lt 4 ] – bufh Apr 22 '15 at 11:51

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


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

share|improve this answer
This is better than just running bash --version, because it confirms that you are currently running bash, not just that you have bash installed on your system. – Flimm Apr 11 '13 at 9:23
+1 bash --version does not show the bash you are currently using. – gabeio Mar 6 '14 at 1:38
Beware: A set BASH_VERSION does not ensure that you are running bash: export BASH_VERSION; csh -c 'echo $BASH_VERSION $SHELL $shell', so $BASH_VERSION may be set in csh as well – Tino Nov 25 '14 at 19:48
@Tino well, you could do a $SHELL --version, but again SHELL might be overwritten (and all shell do not support the --version flag). – bufh Apr 22 '15 at 11:43

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 some kind of mess with environment variables.

share|improve this answer

No, everything is alright. From man bash:

          Equivalent to  -v.

It is just not as silent as usual. Try



share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.