Info

From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page Info and the translation is 68% complete.
Resources
This article has some todo items:
  • Rework to be less verbose.
  • etc.
Pinfo showing directory node.

info コマンドは、コンピュータプログラムのドキュメンテーションを含む info ページを閲覧するために使用されます。Texinfo ドキュメンテーションシステムの一部です。

ほとんどのユーザーは man 文書システムに慣れ親しんでいるでしょう。man システムは項目をすばやく探すのが得意な一方で、man ページ同士をリンクする構造が欠落しています。info ページはページ同士をリンクしたり、メニューを作ってナビゲーションを楽にすることが出来ます。man ページの内容は info システムを補完する場合もあれば、それぞれ異なる内容の場合もあり、どちらか一方にしか情報がまったく無い場合もあるでしょう。

info ページは、システムがインターネットに接続していない状態でも読むことができます。ファイルは通常は /usr/share/info に保存されていますが、info コマンドなどの専用プログラムを利用して閲覧されます。

システム上に、標準化されたアクセスしやすい方法でドキュメントが存在していることは、本当に便利なことです。info と man のページから答えを探す習慣を付けるのは非常に優れた取り組みです。これらには、利用可能な中で最もよくまとまった文書が含まれることが多いからです。

インストール

システムによってはすでに info があるかもしれません。その場合この節はスキップしてください。info がすでにインストールされているか確認するには、whereis info (これは sys-apps/util-linux に属し、通常は system 集合の一部です) を入力してください。

emerge

sys-apps/texinfo パッケージをインストールしてください:

root #emerge --ask sys-apps/texinfo

pinfo

pinfo (app-text/pinfo) は、色付きで、改良された閲覧機能を備えた、info ビューワのの代替です。望むならばこれを sys-apps/texinfo の代わりとして、あるいは両方を同時にインストールすることができます (その場合、この文書の以降の部分の infopinfo と読み替えてください):

root #emerge --ask sys-apps/pinfo

さらなる情報については、pinfo のドキュメンテーションweb サイト、および github を参照してください。

使い方

呼び出し

info ページの閲覧と、ページ間の移動を始めるには、info を引数無しで呼び出してください。システム上に保管されている文書の概要が表示されるでしょう:

user $info

オプション:

user $info --help
Usage: info [OPTION]... [MENU-ITEM...]

Read documentation in Info format.

Frequently-used options:
  -a, --all                    use all matching manuals
  -k, --apropos=STRING         look up STRING in all indices of all manuals
  -d, --directory=DIR          add DIR to INFOPATH
  -f, --file=MANUAL            specify Info manual to visit
  -h, --help                   display this help and exit
      --index-search=STRING    go to node pointed by index entry STRING
  -n, --node=NODENAME          specify nodes in first visited Info file
  -o, --output=FILE            output selected nodes to FILE
  -O, --show-options, --usage  go to command-line options node
      --subnodes               recursively output menu items
  -v, --variable VAR=VALUE     assign VALUE to Info variable VAR
      --version                display version information and exit
  -w, --where, --location      print physical location of Info file

The first non-option argument, if present, is the menu entry to start from;
it is searched for in all 'dir' files along INFOPATH.
If it is not present, info merges all 'dir' files and shows the result.
Any remaining arguments are treated as the names of menu
items relative to the initial node visited.

For a summary of key bindings, type H within Info.

Examples:
  info                         show top-level dir menu
  info info-stnd               show the manual for this Info program
  info emacs                   start at emacs node from top-level dir
  info emacs buffers           select buffers menu entry in emacs manual
  info emacs -n Files          start at Files node within emacs manual
  info '(emacs)Files'          alternative way to start at Files node
  info --show-options emacs    start at node with emacs' command line options
  info --subnodes -o out.txt emacs
                               dump entire emacs manual to out.txt
  info -f ./foo.info           show file ./foo.info, not searching dir

Email bug reports to bug-texinfo@gnu.org,
general questions and discussion to help-texinfo@gnu.org.
Texinfo home page: http://www.gnu.org/software/texinfo/

info ページを閲覧する

info が立ち上がると、画面はこんな感じになります:

コード info 画面のサンプル
File: dir,      Node: Top       This is the top of the INFO tree
 
  This (the Directory node) gives a menu of major topics.
  Typing "q" exits, "?" lists all Info commands, "d" returns here,
  "h" gives a primer for first-timers,
  "mEmacs<Return>" visits the Emacs manual, etc.
 
  In Emacs, you can click mouse button 2 on a menu item or cross reference
  to select it.
 
* Menu:
 
User Interface Toolkit
* GDK: (gdk).           The General Drawing Kit
* GTK: (gtk).           The GIMP Toolkit
 
GNU programming tools
* Autoconf v2.1: (autoconf).         Create source code configuration scripts.

先頭にアスタリスクの付いた項目がたくさん並んでいます。これらは、異なるノードレベル間を移動するためのメニュー項目です。

メニューを選択する方法は、矢印と数字の 2 通りがあります。wget info ページを見るには、矢印キーで移動して、wget の行に到達するまで キーを使用してください:

コード wget info メニュー項目に移動する
Network Applications
* GnuTLS: (gnutls).                     Package for Transport Layer Security.
* Wget: (wget).         The non-interactive network downloader.
* certtool: (gnutls)Invoking certtool.  Manipulate certificates and keys.
* gnutls-cli: (gnutls)Invoking gnutls-cli.      GNU TLS test client.
* gnutls-cli-debug: (gnutls)Invoking gnutls-cli-debug.  GNU TLS debug client.
* gnutls-serv: (gnutls)Invoking gnutls-serv.    GNU TLS test server.
* srptool: (gnutls)Invoking srptool.    Simple SRP password tool.

この行に来たら、Enter キーを押してメニュー項目を選択してください。これで wget の info ページが表示されるでしょう:

コード wget info ページ
File: wget.info,  Node: Top,  Next: Overview,  Up: (dir)
 
Wget 1.10.2
***********
 
This manual documents version 1.10.2 of GNU Wget, the freely available
utility for network downloads.
 
   Copyright (C) 1996-2005 Free Software Foundation, Inc.
 
* Menu:
 
* Overview::            Features of Wget.
* Invoking::            Wget command-line arguments.
* Recursive Download::  Downloading interlinked pages.
* Following Links::     The available methods of chasing links.
* Time-Stamping::       Mirroring according to time-stamps.
* Startup File::        Wget's initialization file.

In terms of nodes, this is considered the Top node for the wget page. Consider the Top node to be the same as the table of contents for that particular info page.

To navigate the page itself, users have a couple of different methods. First off is the standard info method. This is using the Space key to move forward a page and the Backspace/Delete keys to move back a page. This is the recommended method as it automatically advances/retreats to the appropriate node in the document. In order to skip entire nodes without using Space/Backspace/Delete, users can also use the [ (advance backwards) and ] (advance forwards) keys.

Another way to navigate is through the Page up/Page down keys. These work, but they will not advance/retreat like Space/Backspace/Delete will.

As mentioned earlier, there are two ways of selecting menus. The second way will now be described here. The numbers 1-9 can be used to reference to the first-ninth menu entries in a document. This can be used to quickly peruse through documents. For example, users can press 3 to reach the Recursive Download menu entry. So press 3 and it will bring up the Recursive Download screen:

コード Resulting Recursive Download screen
File: wget.info,  Node: Recursive Download,  Next: Following Links,  Prev: Invoking,  Up: Top
 
3 Recursive Download
********************
 
GNU Wget is capable of traversing parts of the Web (or a single HTTP or
FTP server), following links and directory structure.  We refer to this
as to "recursive retrieval", or "recursion".

Here is a good time to note a few things. First off the top header section. This header shows the navigation capable from this particular screen. The page indicated by Next: can be accessed by pressing the n key, and the page indicated by Prev: can be accessed by pressing the p key. Please note that this will only work for the same level. If overused users could round up in totally unrelated content. It's better to use Space/Backspace/Delete/[/] to navigate in a linear fashion.

If for some reason users get lost, there are a few ways to get out. First is the t key. This will take the user straight to the toplevel (table of contents) for the particular info page being browsed. If users want to return to the last page looked out, they can do so with the l key. If users want to go to the above level, they can do so with the u key. The next chapter will look at searching for content.

他の info ページへのナビゲーション

Now that users can navigate an individual info page, it's important to look at accessing other info pages. The first obvious way is to go to the info page through the dir index listing of info pages. To get to the dir index from deep within a document, simply press the d key. From there users can search for the appropriate page they want. However, if they know the actual page, there is an easier way through the Goto node (g key) command. To go to an info page by name, type g to bring up the prompt and enter the name of the page in parentheses:

コード Going to an info page by name
* Startup File::        Wget's initialization file.
* Examples::            Examples of usage.
* Various::             The stuff that doesn't fit anywhere else.
* Appendices::          Some useful references.
* Copying::             You may give out copies of Wget and of this manual.
--zz-Info: (wget.info.gz)Top, 24 lines --Top-------------------------------
Goto node: (libc)

This will bring up the libc page as shown here:

コード Result of the Goto node command
File: libc.info,  Node: Top,  Next: Introduction,  Prev: (dir),  Up: (dir)
 
Main Menu
*********
 
This is Edition 0.10, last updated 2001-07-06, of `The GNU C Library
Reference Manual', for Version 2.3.x of the GNU C Library.
 
* Menu:
 
* Introduction::                 Purpose of the GNU C Library.

Now that users know how to go to info pages by name, the next section will look at searching for pieces of information using the info page's index.

info を通しての検索

索引をつかった検索

The following example will describe how to lookup the printf function of the C library using the libc info page's index. Users should still be at the libc info page from the last section, and if not, they can use the Goto node command to do so. To utilize the index search, hit the i key to bring up the prompt, then enter the search term:

コード Entering an index search query
* Character Set Handling::       Support for extended character sets.
* Locales::                      The country and language can affect the
                                   behavior of library functions.
* Message Translation::          How to make the program speak the user's
                                   language.
--zz-Info: (libc.info.gz)Top, 1291 lines --Top-- Subfile: libc.info-1.gz-----
Index entry: printf

After pressing Enter upon completion of our query, users are brought to the libc definition for printf:

コード Result of the index search query
File: libc.info,  Node: Formatted Output Functions,  Next: Dynamic Output,  Prev: Other Output Conversions,  Up: Formatted Output
 
12.12.7 Formatted Output Functions
----------------------------------
 
This section describes how to call `printf' and related functions.
Prototypes for these functions are in the header file `stdio.h'.
Because these functions take a variable number of arguments, you _must_
declare prototypes for them before using them.  Of course, the easiest
way to make sure you have all the right prototypes is to just include

Users have successfully performed a search using the libc info page index. However, sometimes what users want is in the page itself. The next section will look at performing searches within the page.

検索コマンドを使った検索

Starting from the previous location at the Formatted Output Functions node, users will look at searching for the sprintf variation of the printf function. To perform a search, press the s key to bring up the search prompt, and then enter the query (sprintf in this case):

コード Entering a search query
-- Function: int wprintf (const wchar_t *TEMPLATE, ...)
     The `wprintf' function prints the optional arguments under the
     control of the wide template string TEMPLATE to the stream
     `stdout'.  It returns the number of wide characters printed, or a
--zz-Info: (libc.info.gz)Formatted Output Functions, 127 lines --Top-- Subfile: libc.info-3.gz--
Search for string []: sprintf

Enter を叩くとクエリの結果が表示されます。

コード Result of the search query
-- Function: int sprintf (char *S, const char *TEMPLATE, ...)
     This is like `printf', except that the output is stored in the
     character array S instead of written to a stream.  A null
     character is written to mark the end of the string.
 
     The `sprintf' function returns the number of characters stored in
     the array S, not including the terminating null character.

This is the needed function.

ディスク上に保存されている info ページ

主な info ページは /usr/share/info に蓄積されます。man 形式のディレクトリレイアウトとは異なり、/usr/share/info は、サイズが大きく、そして多くのファイルの集合体が入っており、下記のようなフォーマットです:

コード info のファイル形式
pagename.info[-node].gz

pagename is the actual name of the page (example: wget). [-node] is an optional construct that designates another node level (generally these are referenced to by the toplevel of the info document in question).

In order to save space these info pages are compressed using the gzip compression scheme by default. Configure the PORTAGE_COMPRESS variable in /etc/portage/make.conf to choose different compression algorithms.

Additional info pages can be listed with the INFOPATH environment variable (usually set through the various /etc/env.d/ files).

The /usr/share/info/dir file is used when info is run with no parameters. It contains a listing of all info pages available for users to browse.

追加のツール

よりフレンドリーなグラフィカルインターフェースで info ページを閲覧したい人にとって作業を簡単にするために、以下のツールを利用することができます:

また、KDE 標準のブラウザ Konqueror では info:で始まる URI で info ページを閲覧できます。

追加の文書

  • 自身のドキュメントを閲覧するために info コマンドを使用することができます:
user $info info
  • man ページにも利用可能なドキュメントがあります:
user $man info

関連項目

  • Man page — contains system reference documentation. It is found on most Unix-like systems.
  • tldr — a succinct help system for CLI commands.

This page is based on a document formerly found on our main website gentoo.org.
The following people contributed to the original document: Chris White
They are listed here because wiki history does not allow for any external attribution. If you edit the wiki article, please do not add yourself here; your contributions are recorded on each article's associated history page.