How to find version of CUDA

Users of CUDA usually know its major.minor version.

If you want to know the full major.minor.patch version of CUDA you are using:

$ cat /usr/local/cuda/version.txt

For example, when I tried on my CUDA 9.2 installation:

$ cat /usr/local/cuda-9.2/version.txt                                                                                                                                                                        
CUDA Version 9.2.148

How to find version of Cygwin

The command is the same as what you would use to find the version of the kernel on a Linux system:

$ uname -r

Another method is to check the version of the cygwin package:

$ cygcheck -c | grep cygwin

Tried with: Cygwin 2.10.0-1 and Windows 10

Invalid version number error with Python


I tried to import a Python package that I had installed from source. The import failed with this error:

File "/usr/lib/python2.7/distutils/", line 40, in __init__
File "/usr/lib/python2.7/distutils/", line 107, in parse
  raise ValueError, "invalid version number '%s'" % vstring
ValueError: invalid version number '2.7.0rc3'


It turns out that package version number has to be in the x.y.z format. Else Python throws this error.

Since I had the source code of this package, I found all instances of 2.7.0rc3 and changed it to 2.7.0. Typically, this will be in the and files. I removed the previously installed package and reinstalled this changed source code. I was able to import after this successfully.

Tried with: Ubuntu 14.04

How to find version of XFree86

XFree86 is an implementation of the X Window System. You may need to know which version of XFree86 is running on your computer.

Finding this is easy:

$ X -version

For information about other options:

$ X -help

The X man page does not list any of the options and is not useful for this purpose.

Tried with: X 1.17.1 and Ubuntu 14.04

How to switch GCC version using update-alternatives

Multiple versions of GCC can be installed and used on Ubuntu as described here. The update-alternatives tool makes it easy to switch between multiple versions of GCC.

On Ubuntu, gcc and g++ are just symbolic links to the actual binaries of a specific version of GCC. By switching the version, invoking gcc will execute the particular version of the compiler binary that you wish. You can make any of these version as the default at any time effortlessly.

As an example, I had installed GCC version 4.8 from the Ubuntu repositories. This was the default version of GCC, so gcc was a symlink to gcc-4.8 binary. Wanting to use some new C++11 features I installed version 4.9 of GCC. This compiler can be invoked using gcc-4.9. I now want to switch the default gcc to invoke gcc-4.9. I also want the freedom to switch back 4.8 as the default whenever I want. You can switch the symlinks yourself manually, but using this tool makes it easy and clean.

Let us begin:

  • Decide which set of symbolic links you want to group together as one unit. I like to switch /usr/bin/gcc and /usr/bin/g++ together.

  • Pass update-alternatives the first version of these symbolic links. Here I will inform about the 4.8 version of these tools and links:

$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 100 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8

Here, we have provided the gcc as the master and g++ as slave. Multiple slaves can be appended along with master. When master symbolic link is changed, the slaves will be changed too.

  • Pass the second version of these tools to be recorded:
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 50 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9 
  • Now you can switch between these versions by using:
$ sudo update-alternatives --config gcc

Tried with: Ubuntu 14.04

Unsupported major.minor version error


I executed a Java program downloaded from the web and got this error:

Exception in thread "main" java.lang.UnsupportedClassVersionError: net/filebot/Main : Unsupported major.minor version 52.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(
    at Method)
    at java.lang.ClassLoader.loadClass(
    at sun.misc.Launcher$AppClassLoader.loadClass(
    at java.lang.ClassLoader.loadClass(
    at sun.launcher.LauncherHelper.checkAndLoadMain(


This error from the Java virtual machine (VM) executing the Java class file indicates that the version 52.0 is not supported by it. This is usually means that the Java program requires a newer version of Java VM for its execution.

The mysterious part is the number 52, which is much higher than any Java version we know. This is a Java class file format version number. The Java version that maps to 52 can be found from the table of class file format version to Java version mapping. For 52.0, it is Java 8. So, this error means that I need to have Java 8 VM to execute this class file. That was correct since I had Java 7 on this computer.

Major.Minor version of Java class file

A Java class file holds the Java bytecode for a Java class that can be executed on a Java virtual machine (VM). Encoded at the beginning of a class file is a major and minor version number of the class file format that is used in it. This major.minor number indicates which Java VM can execute this class file. The class file format is typically changed with a new release of Java.

The mapping from Java version to the major number is as follows:

J2SE 8 = 52
J2SE 7 = 51
J2SE 6.0 = 50
J2SE 5.0 = 49
JDK 1.4 = 48
JDK 1.3 = 47
JDK 1.2 = 46
JDK 1.1 = 45

Reference: Wikipedia page on Java class file

How to find version of Debian or Raspbian

Raspbian is based on Debian, so the distribution version information for both is stored in the same file: /etc/os-release.

Here is what I got on my Raspbian 9 (Stretch):

$ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION="9 (stretch)"

Visual Studio versions

Visual Studio has a branded name with a year (like Visual Studio 2013), but also an internal version number. Visual Studio supports a C++ compiler, a C# compiler, the .Net Framework and many other internal tools. Each of these also have their own version names and numbers. Confusingly, either the year-version or version-number is used at several places in Windows.

Here is some information I note down and update as I use these software:

Visual Studio 2015

  • Visual Studio: 14
  • Visual C++ compiler: 19.0.23026.0
  • Visual C compiler: 19.0.23026.0

Visual Studio Professional 2013

  • Visual Studio: 12.0
  • Visual C++ compiler: 18.0.21005.1
  • Visual C compiler: 18.0.21005.1
  • Microsoft .Net Framework: 4.5.50938

Visual Studio Professional 2012

  • Visual Studio: 11.0
  • Visual C++ compiler: 17.00.50727.1
  • Visual C compiler: 17.00.50727.1