info - macOS
Overview
The info
command on macOS provides a means to view the Info documentation files. Known for a more comprehensible and hyperlink-rich format than traditional man pages, info
pages offer an organized structure with menu items, nodes, and navigational links to browse through detailed documentation. It is highly useful for users seeking an in-depth understanding of various commands and programs in a structured and linked format.
Syntax
The general syntax of the info
command is:
info [options] [menu-item]
- menu-item is optional and specifies a particular file or topic the user wants to read about.
Options/Flags
Here are the main options used with info
:
--version
: Displays version information aboutinfo
.--help
: Shows the help message and exits.-a
,--all
: When searching, match all documentation, not only the first found.-k KEYWORD
,--apropos=KEYWORD
: Search for KEYWORD in allinfo
files, similar to the functionality ofman -k
.-d DIR
,--directory=DIR
: Add DIR to the list of directories searched forinfo
documentation files.-f FILE
,--file=FILE
: View theinfo
file specified by FILE.-o FILE
,--output=FILE
: Output the content to FILE instead of on the screen.-h
,--header
: Output first page header, despite start-up default settings.
Examples
- Viewing an
info
page:
info grep
This command opens the info
documentation for grep
.
- Searching within all
info
pages:
info -k sort
This searches for the keyword “sort” in all info
documents.
- Outputting
info
content to a file:
info coreutils -o coreutils_info.txt
This saves the info
pages of coreutils into the file coreutils_info.txt
.
Common Issues
-
Documentation not found: If
info
fails to locate a specific document, ensure you have the documentation installed or check the directory path set using-d
or--directory
. macOS might not have allinfo
files by default. -
Output cluttered when redirected: When using
info
output redirection to a file, the result might include control characters. Use suitable viewing tools or applications that understand the formatting.
Integration
Combine info
with shell scripts to automate the retrieval and processing of documentation content. For example:
info bash --output=~/bash_info.txt
grep -i "loop" ~/bash_info.txt
This script outputs the info
page for bash to a file and then searches for “loop” within that file.
Related Commands
man
: Display the system’s manual pages.apropos
: Search the manual page names and descriptions.
For further reading on info
and man
, you can visit the official GNU documentation online at GNU.org.