Search notes:

gcc -dumpversion

gcc -dumpversion prints the compiler's version.
The version number is used in filesystem paths and specs.
The returned version number can be one, two or three digites (separated by a dot).
$ gcc -dumpversion
10

See also

-dumpfullversion prints always three digits.
The version number is found in directories such as /usr/lib/gcc/x86_64-linux-gnu/VERSION
GCC options such as --version

Index