2016-11-19

style, Help:Style/White space

← Older revision

Revision as of 11:45, 19 November 2016

(One intermediate revision by the same user not shown)

Line 21:

Line 21:

Manuals are sorted into several sections. For a full listing see the section entitled "Sections of the manual pages" in {{ic|man man-pages}}.

Manuals are sorted into several sections. For a full listing see the section entitled "Sections of the manual pages" in {{ic|man man-pages}}.



Man pages are usually referred to by their name, followed by their section number in parentheses. Often there are multiple man pages of the same name, such as man
(
1
)
and man
(
7
)
. In this case, give man the section number followed by the name of the man page, for example:

+

Man pages are usually referred to by their name, followed by their section number in parentheses. Often there are multiple man pages of the same name, such as
{{
man
|
1
|man}}
and
{{
man
|
7
|man}}
. In this case, give man the section number followed by the name of the man page, for example:

$ man 5 passwd

$ man 5 passwd

Line 28:

Line 28:

One-line descriptions of man pages can be displayed using the {{Ic|whatis}} command. For example, for a brief description of the man page sections about {{ic|ls}}, type:

One-line descriptions of man pages can be displayed using the {{Ic|whatis}} command. For example, for a brief description of the man page sections about {{ic|ls}}, type:



{{hc|$ whatis ls|ls (1p)              - list directory contents

+



ls (1)              - list directory contents}}

+

{{hc|$ whatis ls|

+

ls (1p)              - list directory contents

+

ls (1)              - list directory contents

+

}}

== Format ==

== Format ==

+

Man pages all follow a fairly standard format, which helps in navigating them. See the section entitled "Sections within a manual page" in {{ic|man man-pages}}.

Man pages all follow a fairly standard format, which helps in navigating them. See the section entitled "Sections within a manual page" in {{ic|man man-pages}}.

== Searching manuals ==

== Searching manuals ==

+

Even though the {{Ic|man}} utility allows users to display man pages, and search their contents via ''less'', a problem arises when one knows not the exact name of the desired manual page in the first place! Fortunately, the {{Ic|-k}} or {{Ic|--apropos}} options can be used to search the manual page descriptions for instances of a given keyword.

Even though the {{Ic|man}} utility allows users to display man pages, and search their contents via ''less'', a problem arises when one knows not the exact name of the desired manual page in the first place! Fortunately, the {{Ic|-k}} or {{Ic|--apropos}} options can be used to search the manual page descriptions for instances of a given keyword.

The research feature is provided by a dedicated cache. By default you may not have any cache built and all your searches will give you the ''nothing appropriate'' result. You can generate the cache or update it by running

The research feature is provided by a dedicated cache. By default you may not have any cache built and all your searches will give you the ''nothing appropriate'' result. You can generate the cache or update it by running

+

# mandb

# mandb

+

You should run it everytime a new manpage is installed.

You should run it everytime a new manpage is installed.

Line 57:

Line 64:

If you want to do a more in-depth search by matching the keywords found in the whole articles, you can use the {{ic|-K}} option:

If you want to do a more in-depth search by matching the keywords found in the whole articles, you can use the {{ic|-K}} option:

+

$ man -K password

$ man -K password

Line 71:

Line 79:

If the number of columns in the terminal is too small (e.g. the window width is narrow), the line breaks will be wrong. This can be very disturbing for reading. You can fix this by setting the MANWIDTH on {{Ic|man}} invocation. With {{Ic|Bash}}, that would be:

If the number of columns in the terminal is too small (e.g. the window width is narrow), the line breaks will be wrong. This can be very disturbing for reading. You can fix this by setting the MANWIDTH on {{Ic|man}} invocation. With {{Ic|Bash}}, that would be:



{{Hc|~/.bashrc|

+

{{Hc|~/.bashrc|<nowiki>



<nowiki>man() {

+

man() {

local width=$(tput cols)

local width=$(tput cols)

[ $width -gt $MANWIDTH ] && width=$MANWIDTH

[ $width -gt $MANWIDTH ] && width=$MANWIDTH

Line 83:

Line 91:

== Reading local man pages ==

== Reading local man pages ==

+

Instead of the standard interface, using browsers such as {{Pkg|lynx}} and [[Firefox]] to view man pages allows users to reap info pages' main benefit of hyperlinked text. Alternatives include the following:

Instead of the standard interface, using browsers such as {{Pkg|lynx}} and [[Firefox]] to view man pages allows users to reap info pages' main benefit of hyperlinked text. Alternatives include the following:

Line 90:

Line 99:

=== Converting to browser-readable HTML ===

=== Converting to browser-readable HTML ===

+

==== mdocml ====

==== mdocml ====

+

Install {{AUR|mdocml}} from [[AUR]]. To convert a page, for example {{ic|free(1)}}:

Install {{AUR|mdocml}} from [[AUR]]. To convert a page, for example {{ic|free(1)}}:

+

$ gunzip -c /usr/share/man/man1/free.1.gz | mandoc -Thtml -Ostyle=style.css 1> free.html

$ gunzip -c /usr/share/man/man1/free.1.gz | mandoc -Thtml -Ostyle=style.css 1> free.html

Line 97:

Line 109:

==== man2html ====

==== man2html ====

+

First, install {{Pkg|man2html}} from the official repositories.

First, install {{Pkg|man2html}} from the official repositories.

Now, convert a man page:

Now, convert a man page:

+

$ man free | man2html -compress -cgiurl man$section/$title.$section$subsection.html > ~/man/free.html

$ man free | man2html -compress -cgiurl man$section/$title.$section$subsection.html > ~/man/free.html

Another use for {{Ic|man2html}} is exporting to raw, printer-friendly text:

Another use for {{Ic|man2html}} is exporting to raw, printer-friendly text:

+

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

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

==== man -H ====

==== man -H ====

+

The GNU implementation of man in the Arch repositories also has the ability to do this on its own:

The GNU implementation of man in the Arch repositories also has the ability to do this on its own:

+

$ man -H free

$ man -H free

Line 112:

Line 129:

==== roffit ====

==== roffit ====

+

First install {{AUR|roffit}}{{Broken package link|{{aur-mirror|roffit}}}} from [[AUR]].

First install {{AUR|roffit}}{{Broken package link|{{aur-mirror|roffit}}}} from [[AUR]].

Line 119:

Line 137:

=== Converting to PDF ===

=== Converting to PDF ===

+

man pages have always been printable: they are written in troff, which is fundamentally a typesetting language. If you have ghostscript installed, converting a man page to PDF is actually very easy: {{ic|<nowiki>man -t <manpage> | ps2pdf - <pdf></nowiki>}}. [https://www.google.com/search?q=manpage+pdf+troff&num=100&hl=en&prmd=imvns&source=lnms&tbm=isch&sa=X&ei=5BZpUI3oH6rI2AXvx4CoAw&ved=0CAoQ_AUoAQ&biw=1321&bih=1100 This google image search] should give you an idea of what the result looks like; it may not be to everybody's liking.

man pages have always been printable: they are written in troff, which is fundamentally a typesetting language. If you have ghostscript installed, converting a man page to PDF is actually very easy: {{ic|<nowiki>man -t <manpage> | ps2pdf - <pdf></nowiki>}}. [https://www.google.com/search?q=manpage+pdf+troff&num=100&hl=en&prmd=imvns&source=lnms&tbm=isch&sa=X&ei=5BZpUI3oH6rI2AXvx4CoAw&ved=0CAoQ_AUoAQ&biw=1321&bih=1100 This google image search] should give you an idea of what the result looks like; it may not be to everybody's liking.

Line 156:

Line 175:

== Online Man Pages ==

== Online Man Pages ==

+

There are several online databases of man pages, including:

There are several online databases of man pages, including:



*[http://man7.org/linux/man-pages/index.html Man7.org.] Upstream for Arch Linux's {{pkg|man-pages}}.

+

* [http://man7.org/linux/man-pages/index.html Man7.org.] Upstream for Arch Linux's {{pkg|man-pages}}.



*[https://manned.org/pkg/arch ''Arch Linux man pages'']

+

* [https://manned.org/pkg/arch ''Arch Linux man pages'']



*[http://manpages.debian.net/ ''Debian GNU/Linux man pages'']

+

* [http://manpages.debian.net/ ''Debian GNU/Linux man pages'']



*[http://leaf.dragonflybsd.org/cgi/web-man ''DragonFlyBSD manual pages'']

+

* [http://leaf.dragonflybsd.org/cgi/web-man ''DragonFlyBSD manual pages'']



*[http://www.freebsd.org/cgi/man.cgi ''FreeBSD Hypertext Man Pages'']

+

* [http://www.freebsd.org/cgi/man.cgi ''FreeBSD Hypertext Man Pages'']



*[http://www.manpages.spotlynx.com/ ''Linux and Solaris 10 Man Pages'']

+

* [http://www.manpages.spotlynx.com/ ''Linux and Solaris 10 Man Pages'']



*[http://linux.die.net/man/ ''Linux man pages at die.net'']

+

* [http://linux.die.net/man/ ''Linux man pages at die.net'']



*[http://www.kernel.org/doc/man-pages/ The Linux man-pages project at kernel.org]

+

* [http://www.kernel.org/doc/man-pages/ The Linux man-pages project at kernel.org]



*[http://netbsd.gw.com/cgi-bin/man-cgi ''NetBSD manual pages'']

+

* [http://netbsd.gw.com/cgi-bin/man-cgi ''NetBSD manual pages'']



*[http://developer.apple.com/documentation/Darwin/Reference/ManPages/index.html ''Mac OS X Manual Pages'']

+

* [http://developer.apple.com/documentation/Darwin/Reference/ManPages/index.html ''Mac OS X Manual Pages'']



*[http://unixhelp.ed.ac.uk/alphabetical/index.html ''On-line UNIX manual pages'']

+

* [http://unixhelp.ed.ac.uk/alphabetical/index.html ''On-line UNIX manual pages'']



*[http://www.openbsd.org/cgi-bin/man.cgi ''OpenBSD manual pages'']

+

* [http://www.openbsd.org/cgi-bin/man.cgi ''OpenBSD manual pages'']



*[http://man.cat-v.org/plan_9/ ''Plan 9 Manual — Volume 1'']

+

* [http://man.cat-v.org/plan_9/ ''Plan 9 Manual — Volume 1'']



*[http://man.cat-v.org/inferno/ ''Inferno Manual — Volume 1'']

+

* [http://man.cat-v.org/inferno/ ''Inferno Manual — Volume 1'']



*[http://sfdoccentral.symantec.com/sf/5.0MP3/linux/manpages/index.html ''Storage Foundation Man Pages'']

+

* [http://sfdoccentral.symantec.com/sf/5.0MP3/linux/manpages/index.html ''Storage Foundation Man Pages'']



*[http://www.unix.com/man-page/OpenSolaris/1/man/ ''The UNIX and Linux Forums Man Page Repository'']

+

* [http://www.unix.com/man-page/OpenSolaris/1/man/ ''The UNIX and Linux Forums Man Page Repository'']



*[http://manpages.ubuntu.com/ ''Ubuntu Manpage Repository'']

+

* [http://manpages.ubuntu.com/ ''Ubuntu Manpage Repository'']

{{Warning|Some distributions provide patched or outdated man pages that differ from those provided by Arch. Exercise caution when using online man pages.}}

{{Warning|Some distributions provide patched or outdated man pages that differ from those provided by Arch. Exercise caution when using online man pages.}}

Line 198:

Line 218:

* {{man|5|terminfo}}

* {{man|5|terminfo}}

* {{man|7|utf-8}}

* {{man|7|utf-8}}

+

More generally, have a look at category 7 pages:

More generally, have a look at category 7 pages:

+

$ man -s 7 -k ".*"

$ man -s 7 -k ".*"

Show more