GNU信息有什么用?


62

我了解GNU Info是什么以及如何使用它,但是它的作用什么?为什么它与手册页并行存在?为什么不编写详细的手册页而不提供单独的实用程序?


3
texinfo文件可以做更多的groff宏。
约旦

15
与手册页相比,它有一个优势:“超链接”。其余的都是缺点,从“此处未发明” Syndrom,有趣的键绑定,目录维护的麻烦等等。
詹斯(Jens)

4
使用info --vi-keys,使信息的按键组合倍感熟悉。您也可以less与信息结合使用,使其看起来像maninfo --subnodes -o - $1 | less。但是,您确实会丢失一些文本格式。

1
或者,将浏览器指向gnu.org/manual。(使用Vimperator / Vrome是可选的。)
nwk

Answers:


63

GNU Info旨在提供全面,超链接的文档,并可以输出为多种格式。

手册页可用,它们擅长提供打印输出。但是,它们的设计使得每个手册页都包含少量内容。手册页可能只讨论了单个C函数,例如printf(3),或者描述了ls(1)命令。

当您进入较大的系统时,这种情况就会崩溃。您如何将Emacs的文档放入手册页中?问题的一个例子是Perl手册页,其中列出了174个单独的手册页,您可以阅读这些手册页来获取信息。您如何浏览这些内容,或者进行搜索以找出&&是什么意思?

作为对手册页的改进,Info为我们提供了:

  1. 具有用于大型系统的单个文档的能力,该文档包含有关该系统的所有信息。(相对于174个手册页)
  2. 能够对整个文档进行全文搜索(v。man -k仅检查关键字)
  3. 指向相同或不同文档的不同部分的超链接(v。另请参见部分,该手册由某些(但不是全部)手册页查看器制成超链接)
  4. 文档的索引,可以浏览该索引,也可以单击“ i”并输入一个术语,它将搜索该索引并将您带到正确的位置(v。Nothing)
  5. 跨概念的线性文档浏览,允许您通过鼠标或按键(无内容)阅读上一节和下一节。

仍然有意义吗?如今,大多数人会说“此文档不属于手册页”,而是将其放入PDF或将其放入HTML。实际上,多个OS上的帮助系统都是基于HTML的。但是,当创建GNU Info(1986年)时,HTML尚不存在。如今,texinfo允许您创建PDF,Info或其他格式,因此您可以根据需要使用这些格式。

这就是发明GNU Info的原因。


6
man -K foo带有大写字母的选项会进行全局全文搜索。尝试man -K global-apropos-它会man以英语和当地语言自行找到页面。
Volker Siegel 2014年

1
您如何找到“ &&”的含义?...您在索引中查找:“ man perl”,从中可以看到概述,教程,参考手册,内部知识,杂项(书籍,社区资源,许可证,变更日志) (〜40),特定于语言和平台的文档。对于“ &&”,我在参考部分中查找语法,数据和运算符,就像大多数语言参考手册一样,是前三部分。因此,我查看了perlop的联机帮助页,第二屏向下列出了所有运算符,将其与找出--vi-mode arg到“ info”的键进行了比较……祝您好运
Astara

41

发明信息系统的原因是必要的,但我想“懒惰,傲慢和不耐烦”是一个很好的解释。

GNU项目的重点是开发可自由修改且可自由分发的操作系统和工具。传统的Unix man系统基于Bell Labs的nroff / troff文档格式化系统,当时是商业(非免费)软件。最终,该系统进行了逆向工程,并创建了一个名为groff的免费替代产品,但是那是GNU项目启动后的几年。因此,在此之前将man系统用于GNU文档将需要实施troff替换,这是一项艰巨的任务。

同时,GNU Emacs是GNU的第一个大型项目,它需要大量的文档。面对实施GNU系统的繁重工作,Richard Stallman寻求可在其系统中使用的现有软件。TeX已经存在并且具有强大的文档格式化功能。与nroff / troff不同,TeX可以免费使用和重新分发。Texinfo创建为文档系统,以利用TeX的功能来印刷手册,并利用GNU Emacs进行处理和在线文档阅读。原始的Texinfo处理器和Info文档浏览器都是用Lisp编写的,并在Emacs中运行。独立的Texinfo实用程序在几年后问世。


20

就像Wikipedia页面上说的那样,TeXinfo是Richard Stallman设计的GNU项目的正式文档。它是TeX之上的一组宏,旨在编写软件手册。我认为Stallman认为手册页不足以完成任务。与手册页相比,Texinfo具有的两个优点是它是超链接的,其次,根据设计,它很容易转换为其他格式。

附录:尽管与该问题并不严格相关,但请注意,手册页仍被视为类似Unix的免费系统上的标准文档系统,例如在Linux内核之上运行的系统以及各种BSD版本。例如,Debian软件包模板鼓励为任何命令添加手册页,并且lintian检查手册页。Texinfo仍未在GNU项目之外广泛使用。


2
+1特别是关于超文本的注释,我认为这是要摆脱(当时比现在更多)面向硬拷贝的man格式的主要原因。
2013年

@ChristopherSchultz编辑
Faheem Mitha

我习惯于书籍作为参考资料。我可以从头到尾阅读它们。如果手册和书籍不足以编写文档,则永远不会教过计算机和语言。在学习过程中,大多数人遵循从低>高的知识到以更简单的主题为基础的更复杂的主题的过程。书籍几乎是每个孩子都能学到的东西-顺序呈现的信息。H-link用于关注感兴趣的随机主题:如果您是主题的专家和大师,您知道自己想要的,链接可以带您快速到达那里。供参考和学习,链接不合适。
阿斯塔拉(Astara)

7

实用的角度来看,info三个级别的参考文档中最详细的:

这三个级别通常会越来越详细:

--help作为一个普通的命令选项-简短的用法总结
man-经典的人的页面,快速参考,并
info-更详细的,GNU-speciffic手册-的全面,官方文档

如果info页面不可用,则手册页通常包含完整的文档。

请注意,手册页包含的信息与--helpGNU coreutils的许多命令的输出完全相同-例如ls

比较ls --helpman ls发现差异仅在于格式。


默认信息观众info
还有更舒适pinfo的GUI 替代方案,例如终端konqueror

pinfo ls

konqueror info:ls


好吧,你很节俭,我给你。
mikeserv

@mikeserv我找不到子答案包含功能。;)
Volker Siegel 2014年

hmmm ...非常有趣,除了您忘了将其help作为内置bash命令的命令,apropos以及whatis作为具有实际使用选项的人提到。

超链接参考不是手册或书。维基?也许可以,但是在离线世界中,手册从来没有附带超链接。它们带有参考(请参阅第38章),但不好学习。最近阅读了C ++的最新书籍,如果您想要有关稍后将涉及的主题的更多信息,我可以同意它使用正向和反向引用。阅读完本书后,这些参考资料可以帮助您找到所需的内容。但是对于一个刚接触复杂程序的人呢?每次都比链接的HTML或信息页面更喜欢一本书。
阿斯塔拉(Astara)

我喜欢信息页面。它们比手册页更像教程,因此对初学者来说要容易得多。尝试info sedinfo grep并用比较man sedman grep。手册页更具技术性,大多数时候都没有示例。我刚才说的有一些例外,但是对于大多数命令来说,它都是正确的。
费尔南多·巴索

3

1-先进但轻巧的技术

手册页是平的。

info 是一棵树。

两者都是基于文本的,因此它们可以在低级系统开发中使用(与http不同,http需要使用完整的GUI和浏览器才能使用。)

这也很有用,因为linux可以在许多低资源机器上运行,例如,可以在Atmel的Arduino上运行的东西info

(历史记录:info类似于gopher,如果您还记得的话。那是我们刚进入GUI OS之前的情况,并且互联网爆炸了。我记得gopher在查找信息方面非常有效,而且速度很快简单易用。它易于扩展,完全基于文本且速度很快。)


手册页不能有可操作的超链接。 (这在这项技术中是不可能的。)

info可以并且确实具有从节点到节点或从节点到叶子的许多可操作链接,这使快速浏览大型手册变得容易得多。


2-包含手册页中找不到的内容

许多标准软件包也有一个姐妹-doc软件包。通常,此内容只能在内部找到info

这些文档包在信息中添加了小册子,并带有小节和小节。在info术语中,这些称为nodes,节点可以nodes在树结构中包含其他节点。

有一些命令可以爬到树上,下面是一些示例:

  • 一节,例如从第2.1节到第2节
  • 下一节(即,沿页面顶部的分支提示移动),例如,从第2节到第2.1节,以及(假设没有第2.2节),再到第3节
  • 一个部分的右边,例如从第2节直接转到第3节,跳过第2.1节

如果您正在阅读并且逐行向下滚动,则将访问每本小册子的所有部分。

重要命令

- -小写'L',如 AST。就像您的网络浏览器上的“ 后退”按钮一样。-返回此窗口中看到的最后一个节点(最初我们只有一个窗口)。 哇,我们也可以将文档窗口分成两半!


d - 我的人 -进入主“ d irectory”节点。-这是INFO树的顶部。包含到家庭的链接:

牛逼 - 我的家人 -转到牛逼本文件的运算节点。-通常是目录

ü - 我的父母 -转到ü P上水平。例如从第2.1节转到第2节。

ñ - 我的兄弟姐妹 -转到ñ在这个层面上扩展节点。例如第2节->第3节(不是2.1)

p - 我的兄弟姐妹 -转到p在这个层面上revious节点。例如第3节->第2节

] - 我的孩子 -转到文档中的下一个节点,例如,第2节->第2.1节

[ - 我的孩子 -转到文档中的上一个节点,例如,第2.1节->第2节


我也不太了解为什么要使用信息。我以前曾涉猎它,最初发现它是老式的。但是因为我需要更多有关autoconf项目的信息,并且有人向我建议这是该文档所在的地方,所以最近我又看了一眼。

我要做的第一件事是弄清楚如何更好地导航。我发现H给予的帮助几乎无济于事。直到我注意到我可以向下滚动到该帮助为止,..但随后出现了太多混乱。

因此,我复制了此帮助并将其粘贴到Gnote中,并开始尝试了解其info工作原理。

随着我学到更多,我为自己改写了他们的帮助。我想知道它们的全部命令是什么,以及它们是如何分类的。

我注意到许多按键都是重复的,有两种或三种方式可以执行给定命令。 我还注意到,这一切看起来都非常像emacs。

这是我的信息命令速查表:

HELP - info - commands

#####################################################################################################################################################
Short list - 'basic' Info command keys (see below for full list)

        C-g         Cancel the current operation.
        H           Close this help window. (toggle help window)
        q           Quit Info altogether.

        h           Invoke the Info tutorial.


        Move in this node
                Up          Move up one line.
                Down        Move down one line.


                PgUp        Scroll backward one screenful.      - also backspace
                PgDn        Scroll forward  one screenful.      - also     space

                Home        Go to the beginning of this node.
                End         Go to the end       of this node.

                TAB         Skip to the next    hypertext link.

                /           Search forward for a specified string.
                }           Search for next     occurrence.
                {           Search for previous occurrence.

        Move to other nodes
                RET         Follow the          hypertext link under the cursor.

                1...9       Pick the first...ninth item in this node's menu.
                0           Pick the last item in this node's menu.

                l           Last in history.  Go back to the last node seen in this window (initially we only have one window). (?? history)


                d           Go to the main 'directory' node.                    my people
        the Info main menu - "This is the top of the INFO tree."

                t           Go to the top node of this document.                my family       Generally the table of contents

                u           Go up one level.                                    my parent       e.g. go from Section 2.1, to Section 2.

                n           Go to the next     node on this level.              my siblings     e.g. section 2 -> section 3  (not 2.1)
                p           Go to the previous node on this level.

                ]           Go to the next     node in the document.            my children     e.g. section 2 -> section 2.1
                [           Go to the previous node in the document.  (?siblings)


                m <name>    Pick a menu item specified by name.
                f           Follow a cross reference specified by name.
                g           Go to a node specified by name.

                i           Search for a specified string in the index (if there is an index), and select the node referenced by the first entry found.

                I           Synthesize menu of matching index entries. ???




#####################################################################################################################################################
Full list - of commands available in Info windows:

Notes: 
        M-              (meta) is Alt;  (also you can use an Esc prefix instead of meta -hwj)
        M-C-            means hold both Ctrl and Alt down at same time
        *               Basic commands (listed above)



     HELP
*               H                                       (get-help-window)               Toggle display of help message
*               h                                       (get-info-help-node)            Visit Info node '(info)Help' (this gets:  man info )


     CANCEL
*                       C-g     C-x C-g M-C-g           (abort-key)                     Cancel current operation  (?? esc)

*               q       C-c                             (quit)                          Quit using Info
                        C-x C-c                         (quit)                          Quit using Info


     WINDOWS
                        C-l                             (redraw-display)                Redraw the display

                x       C-x 0                           (delete-window)                 Delete the current window
                        C-x 1                           (keep-one-window)               Delete all other   windows (leaving 1)

                        C-x 2                           (split-window)                  Split the current  window  (into 2)
                        C-x t                           (tile-windows)                  Divide the available screen space among the visible windows

                        C-x ^                           (grow-window)                   Grow (or shrink) this window

                        C-x o                           (next-window)                   Select the next window (other)

                        C-x C-b                         (list-visited-nodes)            Make a window containing a menu of all of the currently visited nodes

                        C-x w                           (toggle-wrap)                   Toggle the state of line wrapping in the current window

     VIEW OTHER FILE
                        C-x C-f                         (view-file)                     Read the name of a file and select it
                        C-x C-v                         (view-file)                     Read the name of a file and select it


     SCROLL
                        C-v                             (scroll-forward-page-only)      Scroll forward  in this window staying within node      ('v' looks like a down arrow)
                                M-v                     (scroll-backward-page-only)     Scroll backward in this window staying within node      (meta-v is the reverse, or up arrow)

*       PgDn    SPC                                     (scroll-forward)                Scroll forward  in this window (at end moving to next node??)
*       PgUp    DEL     C-h                             (scroll-backward)               Scroll backward in this window (at end moving to next node??)  (DEL = Backspace or Del)

                                M-C-v   ESC PgDn        (scroll-other-window)           Scroll the other window
                                        ESC PgUp        (scroll-other-window-backward)  Scroll the other window backward


     CURSOR MOVEMENT (within a 'node' / page)
        Right           C-f                             ( forward-char)                 Move forward  a character
        Left            C-b                             (backward-char)                 Move backward a character

                                M-b                     (backward-word)                 Move backward a word
                                M-f                     ( forward-word)                 Move forward  a word

                        C-a                             (beginning-of-line)             Move to the start of the line
                        C-e                             (end-of-line)                   Move to the end   of the line


*       Up              C-p                             (prev-line)                     Move up   to the previous line
*       Down            C-n                             (next-line)                     Move down to the next     line

                                M-r                     (move-to-window-line)           Move the cursor to a specific line of the window

*       Home    b               ESC <                   (beginning-of-node)             Move to the start of this node
*       End     e               ESC >                   (end-of-node)                   Move to the end   of this node


     SEARCHING
                /                                       (search)                        Read a string and search          for it
                s                                       (search)                        Read a string and search          for it
                ?                                       (search-backward)               Read a string and search backward for it

                R                                       (toggle-regexp)                 Toggle the usage of regular expressions in searches

                S                                       (search-case-sensitively)       Read a string and search for it case-sensitively

*               }       C-x n                           (search-next)                   Repeat last search in the same    direction
*               {       C-x N                           (search-previous)               Repeat last search in the reverse direction


                        C-s                             (isearch-forward)               Search interactively for a string as you type it
                        C-r                             (isearch-backward)              Search interactively for a string as you type it


                                M-/                     (tree-search)                   Search this node and subnodes for a string.

                                M-}                     (tree-search-next)              Go to next     match in Info sub-tree
                                M-{                     (tree-search-previous)          Go to previous match in Info sub-tree


     JUMP TO NODE CROSS REFERENCES (underlined links to nodes)
*               TAB                                     (move-to-next-xref)             Move to the next     cross reference
                BackTab         M-TAB                   (move-to-prev-xref)             Move to the previous cross reference  (Shift-tab)


     SELECT A NODE (hyperlink)
*               RET                                     (select-reference-this-line)    Select reference or menu item appearing on this line

*               1 .. 9                                  (menu-digit)                    Select this     menu item (link) # in this node's menu (this page's menu)
*               0                                       (last-menu-item)                Select the last menu item (link)   in this node's menu (this page's menu)

                <                                       (first-node)                    Select the first node in this file
                >                                       (last-node)                     Select the last  node in this file


*               d                                       (dir-node)                      Select the 'dir' node (in all files?)   the Info main menu - "This is the top of the INFO tree."

*               t                                       (top-node)                      Select the 'Top' node in this file      Generally the table of contents
*               u                                       ( up-node)                      Select the 'Up'  node in this file      i.e. go from Section 2.1, to Section 2.


*               n                                       (next-node)                     Select the Next node                    i.e. section 2.1 -> section 2.2
*               p                                       (prev-node)                     Select the Prev node


*               g <name>                                (goto-node)                     Read a node name and select it
*               m <item>                                (menu-item)                     Read a menu item and select its node    ???


                        C-x b                           (select-visited-node)           Select a node which has been previously visited in a visible window (c-x=Window, back)



     MOVE TO ANOTHER NODE (in the tree)
*               [                                       (global-prev-node)              Move backwards or up   through node structure (tree within this file)
*               ]                                       (global-next-node)              Move forwards  or down through node structure (tree within this file)

*               l                                       (history-node)                  last - Select the most recently selected node

     GET NODE INFORMATION
                =                                       (display-file-info)             Show full file name of node being displayed
                O                                       (goto-invocation-node)          Find the node describing program invocation


     READ IN NEW MENUS
                G <menus>                               (menu-sequence)                 Read a list of menus starting from dir and follow them  ???


     INDEX
*               i                                       (index-search)                  Look up a string in the index for this file (Search for a specified string in the index 
                                                                                                (if there is an index), and select the node referenced by the first entry found.

                ,                                       (next-index-match)              Go to the next matching index item from the last 'i' command

*               I                                       (virtual-index)                 List all matches of a string in the index

                        C-x f                           (all-files)                     Show all matching files


     FOOTNOTES
*               f                                       (xref-item)                     Read a footnote or cross reference and select its node
                r                                       (xref-item)                     Read a footnote or cross reference and select its node

                                M-C-f                   (show-footnotes)                Show the footnotes associated with this node in another window

     NUMERIC 
                        C-u                             (universal-argument)            Start (or multiply by 4) the current numeric argument
                                M--                     (add-digit-to-numeric-arg)      Add this digit to the current numeric argument
                                M-0 .. M-9              (add-digit-to-numeric-arg)      Add this digit to the current numeric argument


     MISC
                                M-x                     (execute-command)               Read a command name in the echo area and execute it     ?? pwd and ls don't work


#####################################################################################################################################################
The following text commands can only be invoked via M-x (Alt-x -hwj):

        This is a list of longer commands that can be typed, all prefixed with Alt-x:


        M-x scroll-forward-set-window                   Scroll forward  in this window                          and set default window size
        M-x scroll-backward-set-window                  Scroll backward in this window                          and set default window size

        M-x scroll-forward-page-only-set-window         Scroll forward  in this window  staying within node     and set default window size
        M-x scroll-backward-page-only-set-window        Scroll backward in this window  staying within node     and set default window size

        M-x down-line                                   Scroll down by lines
        M-x   up-line                                   Scroll up   by lines

        M-x scroll-half-screen-down                     Scroll down by half screen size
        M-x scroll-half-screen-up                       Scroll up   by half screen size


        M-x prev-window                                 Select the previous             xwindow

        M-x set-screen-height <number>                  Set the height of the displayed window

        M-x  find-menu                                  Move to the start of this node's menu

        M-x visit-menu                                  Visit as many menu items at once as possible

        M-x man <name of man page>                      Read a manpage reference and select it


        M-x print-node                                  Pipe the contents of this node through INFO_PRINT_COMMAND


        M-x clear-search                                Clear displayed search matches


        M-x describe-key <key combo>                    Print documentation for KEY  (one line of documentation)
        M-x where-is                                    Show what to type to execute a given command
        M-x describe-command                            Read the name of an Info command and describe it


        M-x index-apropos                               Grovel all known info file's indices for a string and build a menu (grep widely, and make a menu of what is found)


        M-x describe-variable                           Explain the use of a     variable
        M-x      set-variable                           Set the value of an Info variable


        M-x info-version                                Display version of Info being run




#####################################################################################################################################################
Commands available in the 'echo' area (i.e. at bottom of screen):

        (M- (meta) = Fn  (not alt) -hwj)


        C-l             (redraw-display)                        Redraw the display

        C-g     Esc     (echo-area-abort)                       Cancel or quit operation
        M-C-g           (echo-area-abort)                       Cancel or quit operation


     MOVE
        C-a     Home    (echo-area-beg-of-line)                 Move to the start of this line
        C-e     End     (echo-area-end-of-line)                 Move to the end   of this line

        C-b     Left    (echo-area-backward)                    Move backward a character
        C-f     Right   (echo-area-forward)                     Move forward  a character

        M-b             (echo-area-backward-word)               Move backward a word
        M-f             (echo-area-forward-word)                Move forward  a word

     COMMAND LINE COMPLETIONS
        M-?     ?       (echo-area-possible-completions)        List possible completions
        M-C-v           (echo-area-scroll-completions-window)   Scroll the completions window
        TAB     SPC     (echo-area-complete)                    Insert completion 
        RET     LFD     (echo-area-newline)                     Accept (or force completion of) this line


     DELETE/YANK
        C-d             (echo-area-delete)                      Delete the character under  the cursor
        C-h     DEL     (echo-area-rubout)                      Delete the character behind the cursor

        M-d             (echo-area-kill-word)                   Kill the word following the cursor
        M-DEL           (echo-area-backward-kill-word)          Kill the word preceding the cursor

        C-k             (echo-area-kill-line)                   Kill to the end       of the line
        C-x DEL         (echo-area-backward-kill-line)          Kill to the beginning of the line

        C-y             (echo-area-yank)                        Yank back the contents of the last kill
        M-y             (echo-area-yank-pop)                    Yank back a previous kill


     INSERT
        C-q             (echo-area-quoted-insert)               Insert next  character verbatim
        M-TAB           (echo-area-tab-insert)                  Insert a TAB character


     TRANSPOSE
        C-t             (echo-area-transpose-chars)             Transpose characters at point (and move ahead by one)

     NUMERIC ARGUMENTS ???
        C-u             (universal-argument)                    Start (or multiply by 4) the current numeric argument
        M--             (add-digit-to-numeric-arg)              Add this digit to the current numeric argument
        M-0 .. M-9      (add-digit-to-numeric-arg)              Add this digit to the current numeric argument

        C-x o           (next-window)                           Select the next window
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.