Ren Ren - 6 months ago 15
Linux Question

How to change the default version of gcc man page?

I have installed

gcc-4.8
and
gcc-6
. The default gcc version is
gcc-4.8
, but I want to change the default gcc version to
gcc-6
, so I do the following:

$ sudo update-alternatives --remove-all gcc
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 10
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 20


then the default gcc version has changed to
gcc-6
, but when I run command

$ man gcc


the man page version of gcc is still
gcc-4.8
. How can I change the man page version of gcc to
gcc-6
? Thanks!

Sorry for my bad English.

Ren Ren
Answer

I have found the solution:

  1. Find the location of gcc-6 man page:

    $ locate gcc-6 | grep 'man'             
    /usr/share/man/man1/gcc-6.1.gz            
    /usr/share/man/man1/x86_64-linux-gnu-gcc-6.1.gz 
    

    so the location of gcc-6 man page is /usr/share/man/man1/gcc-6.1.gz

  2. Remove the file /usr/share/man/man1/gcc.1.gz if it exist:

    $ sudo rm /usr/share/man/man1/gcc.1.gz 
    
  3. Create a symbolic link to /usr/share/man/man1/gcc-6.1.gz:

    $ sudo ln -s /usr/share/man/man1/gcc-6.1.gz /usr/share/man/man1/gcc.1.gz
    

Then run comman:

$ man gcc

You will see the man page version of gcc has changed to gcc-6.
Sorry for my English.