Sunday, November 18, 2012

Colorful Man Pages

    Manual pages are the most important documentation sources for developers. They are not useful only for linux commands but also for c/c++ functions and structures ever for kernel source codes'. In almost every linux distribution, pager is linked to "less" by default so that when an application needs to show output page to page on terminal, "less" is used. However "less" does not give a colorful output.

    If you want to see pages colorful which makes more readable, you can use "most" for that. Link your "pager" to the "most" instead of "less".

   Check your current pager:

        kays@debian:~$ update-alternatives --display pager
        pager - auto mode
          link currently points to /bin/less
        /bin/less - priority 77
          slave pager.1.gz: /usr/share/man/man1/less.1.gz
        /bin/more - priority 50
          slave pager.1.gz: /usr/share/man/man1/more.1.gz
        /usr/bin/pg - priority 10
          slave pager.1.gz: /usr/share/man/man1/pg.1.gz
        /usr/bin/w3m - priority 25
          slave pager.1.gz: /usr/share/man/man1/w3m.1.gz
        Current 'best' version is '/bin/less'.

   "less" is current pager. Install "most" package and make it your default pager as below:

        kays@debian:~$ sudo aptitude install most
        kays@debian:~$ sudo update-alternatives --install /usr/bin/pager pager /usr/bin/most 99

   You can use "--config" options as below by doing interactively:

        kays@debian:~$ sudo update-alternatives --config pager

   Now test your pager. Below is "socket" function manual page.

man socket