6

man is the quick interface to online reference manuals. These are usually stored in /usr/share/man/manN/blah.gz, or similar. Most debian packages also come with a README.debian, which is stored in /usr/share/doc/blah/README.debian. Is there an automated reader for these files, that finds the appropriate README.debian, and opens it?

naught101
  • 739

2 Answers2

9

You can create a simple shell function and place it in your .bashrc:

readme() {
  if [ -e /usr/share/doc/"$1"/README.Debian ]; then
    "$PAGER" /usr/share/doc/"$1"/README.Debian
  else
    echo "No README for $1"
  fi
}

Use:

$ readme vlc

$Id: README.Debian 1436 2008-08-31 23:06:34Z xtophe-guest $

Notes for anyone wanting to build Debian packages of VLC.

 - Default configuration is supposed to be latest unstable.

 - VLC does not link with libdvdcss by default, thus it will not depend
   on the libdvdcss packages. However it will use libdvdread that can
   optionally open libdvdcss if found. To build packages that link directly
   against libdvdcss, remove the --without-dvdcss flag in debian/rules.

$ readme foobar

No README for foobar

You can smarten it up a little when you look for other README files (like the compressed ones which are often present) if the Debian file does not exist. Or collect all README files and offer a choice from which the user can select which one to display.

Marco
  • 33,548
1

The easiest way is to type zless /usr/share/doc/blah/ and press Tab. Less is the text viewer that man calls by default, and zless is a wrapper that automatically decompresses .gz files.

You may want to install the packages dhelp or dwww. Neither does exactly what you want, but dwww is close: it lets you browse all of a package's documentation via a local web server. Dhelp doesn't require a server but doesn't show all non-HTML documentation.

  • 1
    They're often not gzipped, also, presumably they can sometimes be in /usr/local/share/doc/, so it'd be good to automatically find the appropriate file, without typing it manually. – naught101 Dec 25 '12 at 09:54
  • 1
    @naught101 zless can read both gzipped and uncompressed files automatically. –  Dec 25 '12 at 12:22