Man page

From ArchWiki
Revision as of 06:28, 16 December 2009 by Pwd (Talk | contribs) (branched from Post Installation Tips)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Template:Article summary start Template:Article summary text Template:Article summary heading Template:I18n entry Template:Article summary end Man pages (abbreviation for "manual pages") are the extensive documentation that comes preinstalled with almost all substantial UNIX-like operating systems, including Arch Linux. The command used to display them is Template:Codeline.

In spite their scope, man pages are designed to be self-contained documents, consequentially limiting themselves to referring to another man page when it comes to related subjects. This is a sharp contrast with the hyperlink-aware info files, GNU's attempt to replace the traditional man page format.

Colored man pages

For some users, color-enabled man pages allow for a clearer presentation and easier digestion of the content. Given that users new to Linux are prone to spend a considerable amount of time familiarizing themselves with basic userspace tools, setting up a comfortable environment is a necessity to most.

There are two prevalent methods for achieving colored man pages: using Template:Codeline, or opting for Template:Codeline. The former is simpler to configure, at the expense of the advanced functionality that is native to Template:Codeline.

First Method: Using 'most'

Install package Template:Package Official using pacman:

# pacman -S most

This is similar to Template:Codeline and Template:Codeline, yet allows rendering colored text in an easier way.

Edit Template:Filename, uncomment the pager definition and change it to:

DEFINE     pager     most -s

Test the new setup by typing:

$ man whatever_man_page

Modifying the color values requires editing Template:Filename (creating the file if it is not present) or editing Template:Filename for system-wide changes. Example Template:Filename:

% Color settings
color normal lightgray black
color status yellow blue
color underline yellow black
color overstrike brightblue black

Another example showing keybindings similar to Template:Codeline (jump to line is set to 'J'):

% less-like keybindings
unsetkey "^K"
unsetkey "g"
unsetkey "G"
unsetkey ":"

setkey next_file ":n"
setkey find_file ":e"
setkey next_file ":p"
setkey toggle_options ":o"
setkey toggle_case ":c"
setkey delete_file ":d"
setkey exit ":q"

setkey bob "g"
setkey eob "G"
setkey down "e"
setkey down "E"
setkey down "j"
setkey down "^N"
setkey up "y"
setkey up "^Y"
setkey up "k"
setkey up "^P"
setkey up "^K"
setkey page_down "f"
setkey page_down "^F"
setkey page_up "b"
setkey page_up "^B"
setkey other_window "z"
setkey other_window "w"
setkey search_backward "?"
setkey bob "p"
setkey goto_mark "'"
setkey find_file "E"
setkey edit "v"

Second Method: Using 'less'

Alternatively, getting an approximate coloured result in manual pages with Template:Codeline is also a possibility. This method has the advantage that Template:Codeline has a bigger feature set than Template:Codeline, and that might be the preference for advanced users.

Just add the following to Template:Filename (where SHELL is the name of the shell in use):

export LESS_TERMCAP_mb=$'\e[1;31m'
export LESS_TERMCAP_md=$'\e[1;31m'
export LESS_TERMCAP_me=$'\e[0m'
export LESS_TERMCAP_se=$'\e[0m'
export LESS_TERMCAP_so=$'\e[1;44;33m'
export LESS_TERMCAP_ue=$'\e[0m'
export LESS_TERMCAP_us=$'\e[1;32m'

To customize the colors, see http://en.wikipedia.org/wiki/ANSI_escape_code for reference.

Source: http://nion.modprobe.de/blog/archives/572-less-colors-for-man-pages.html

Reading man pages with a browser

Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: please use the first argument of the template to provide a brief explanation. (Discuss in Talk:Man page#)

Info pages' main benefit can be brought to man by using browsers, such as elinks and Firefox, in place of the standard interface.

First, install Template:Package AUR using yaourt or another AUR helper:

$ yaourt -S man2html

Now, Convert a man page:

$ man bash | man2html -compress -cgi-url man$section/$title.$section$subsection.html > ~/man/bash.html

Utility Template:Codeline can also be used to convert man pages to raw text files:

$ man bash | man2html -bare > ~/bash.txt