Ren Ren - 1 year ago 104
Linux Question

How to change the default version of gcc man page?

I have installed

. The default gcc version is
, but I want to change the default gcc version to
, 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
, but when I run command

$ man gcc

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

Sorry for my bad English.

Ren Ren
Answer Source

I have found the solution:

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

    $ locate gcc-6 | grep 'man'             

    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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download