man
スポンサーリンク
何するコマンド?
マニュアルを表示するときに使うコマンド
書き方
man [オプション] [セクション] [対象]
オプション
| オプション | 説明 |
|---|---|
| -C【ファイル】 | 指定した設定ファイルを使う Use this user configuration file rather than the default of ~/.manpath. |
| --config-file=【ファイル】 | 指定した設定ファイルを使う Use this user configuration file rather than the default of ~/.manpath. |
| -d | デバッグメッセージを表示する Print debugging information. |
| --debug | デバッグメッセージを表示する Print debugging information. |
| -D | うんちゃらかんちゃら This option is normally issued as the very first option and resets man's behaviour to its default. Its use is to reset those options that may have been set in $MANOPT. Any options that follow -D will have their usual effect. |
| --default | うんちゃらかんちゃら This option is normally issued as the very first option and resets man's behaviour to its default. Its use is to reset those options that may have been set in $MANOPT. Any options that follow -D will have their usual effect. |
| --warnings | うんちゃらかんちゃら Enable warnings from groff. This may be used to perform sanity checks on the source text of manual pages. warnings is a comma-separated list of warning names; if it is not supplied, the default is "mac". See the “Warnings” node in info groff for a list of available warning names. |
| -f | 「whatis」コマンドと同じ Equivalent to whatis. Display a short description from the manual page, if available. See whatis(1) for details. |
| --whatis | 「whatis」コマンドと同じ Equivalent to whatis. Display a short description from the manual page, if available. See whatis(1) for details. |
| -k | 「apropos」コマンドと同じ Equivalent to apropos. Search the short manual page descriptions for keywords and display any matches. See apropos(1) for details. |
| --apropos | 「apropos」コマンドと同じ Equivalent to apropos. Search the short manual page descriptions for keywords and display any matches. See apropos(1) for details. |
| -K 【文字列】 | 指定文字列を全てのマニュアルから検索する。結構遅いから気を付けてね Search for text in all manual pages. This is a brute-force search, and is likely to take some time; if you can, you should specify a section to reduce the number of pages that need to be searched. Search terms may be simple strings (the default), or regular expressions if the --regex option is used. |
| -global-apropos 【文字列】 | 指定文字列を全てのマニュアルから検索する。結構遅いから気を付けてね Search for text in all manual pages. This is a brute-force search, and is likely to take some time; if you can, you should specify a section to reduce the number of pages that need to be searched. Search terms may be simple strings (the default), or regular expressions if the --regex option is used. |
| -l | ローカルモードとやらで、うんちゃらかんちゃら Activate `local' mode. Format and display local manual files instead of searching through the system's manual collection. Each manual page argument will be interpreted as an nroff source file in the correct format. No cat file is produced. If '-' is listed as one of the arguments, input will be taken from stdin. When this option is not used, and man fails to find the page required, before displaying the error message, it attempts to act as if this option was supplied, using the name as a filename and looking for an exact match. |
| --local-file | ローカルモードとやらで、うんちゃらかんちゃら Activate `local' mode. Format and display local manual files instead of searching through the system's manual collection. Each manual page argument will be interpreted as an nroff source file in the correct format. No cat file is produced. If '-' is listed as one of the arguments, input will be taken from stdin. When this option is not used, and man fails to find the page required, before displaying the error message, it attempts to act as if this option was supplied, using the name as a filename and looking for an exact match. |
| -w | マニュアルは表示しないで、マニュアルのある場所を表示する Don't actually display the manual pages, but do print the location(s) of the source nroff files that would be formatted. |
| --where | マニュアルは表示しないで、マニュアルのある場所を表示する Don't actually display the manual pages, but do print the location(s) of the source nroff files that would be formatted. |
| --path | マニュアルは表示しないで、マニュアルのある場所を表示する Don't actually display the manual pages, but do print the location(s) of the source nroff files that would be formatted. |
| --location | マニュアルは表示しないで、マニュアルのある場所を表示する Don't actually display the manual pages, but do print the location(s) of the source nroff files that would be formatted. |
| -W | やばい Don't actually display the manual pages, but do print the location(s) of the cat files that would be displayed. If -w and -W are both specified, print both separated by a space. |
| --where-cat | 書くのが Don't actually display the manual pages, but do print the location(s) of the cat files that would be displayed. If -w and -W are both specified, print both separated by a space. |
| --location-cat | 面倒になってきた Don't actually display the manual pages, but do print the location(s) of the cat files that would be displayed. If -w and -W are both specified, print both separated by a space. |
| -? | ヘルプを表示する Print a help message and exit. |
| --help | ヘルプを表示する Print a help message and exit. |
| --usage | 簡易ヘルプを表示する Print a short usage message and exit. |
| -V | バージョン情報を表示する Display version information. |
| --version | バージョン情報を表示する Display version information. |
補足事項
オプションは他にも いろいろ あります。
途中で書くのが面倒くさくなったので、全部書くのは諦めました。
ごめんなさい。
あとは
man man
を実行して、頑張って英語を読んでください。
オプションはコンピュータの種類によって多少変わるようです。
オプションは多いですが、使い方は難しくありません。
オプションを何も指定しないで
man ls
のような形で実行すれば、基本的には事足ります。
ちなみに、上記のコマンドを実行すると「ls」コマンドのマニュアルが表示されます。
オプションを指定したくなる機会は多くないはずです。
必要なときに必要な分のオプションを勉強すれば十分だと思います。
あと補足するとすれば、セクションでしょうか。
「man」コマンドで読めるマニュアルには区分があります。
一般的な区分は以下の通りです。
| 区分 | 意味 |
|---|---|
| 1 | 普通のコマンド Executable programs or shell commands |
| 2 | システムコール System calls (functions provided by the kernel) |
| 3 | ライブラリの関数 Library calls (functions within program libraries) |
| 4 | スペシャルファイル Special files (usually found in /dev) |
| 5 | ファイルの形式とか書式 File formats and conventions eg /etc/passwd |
| 6 | ゲーム Games |
| 7 | なんか、いろいろ Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7) |
| 8 | システム管理用のコマンド System administration commands (usually only for root) |
| 9 | うんちゃら Kernel routines [Non standard] |
このマニュアルの区分を「セクション」と言います。
例えば「crontab」というコマンドがあります。
私の環境では「crontab」のマニュアルは2つありました。
それは
1.「crontab」コマンドの使い方のマニュアル
2.「crontab」コマンドで編集するファイルの書き方のマニュアル
の2つです。
「1」は普通にコマンドの使い方のマニュアルです。
区分は「1:普通のコマンド」でしょう。
「2」は編集するファイルの書式に関するマニュアルです。
区分は「5:ファイルの形式とか書式」になります。
ちょっとカッコつけて表現すると
「crontab」のマニュアルはセクション「1」とセクション「5」にある
となります。
そして「man」コマンドを実行するときにはセクションを指定できます。
例えば
man 1 crontab
を実行したとしましょう。
そうすると、セクション「1」のマニュアル、つまり「crontab」コマンドの使い方のマニュアルが表示されます。
同じ要領で
man 5 crontab
を実行したとしましょう。
そうすると、セクション「5」のマニュアル、つまり「crontab」コマンドで編集するファイルの書き方に関するマニュアルが表示されます。
これが「man」コマンドにおけるセクションです。
マニュアルを読んでいて、例えば
cron(8)
のような記述を見たことはないでしょうか。
このカッコの中の数字がセクションを表現しています。
cron(8)
は
「cron」はセクション「8」に分類されるよ
を表現しています。
ですから、cronのマニュアルを見たければ
man 8 cron
を実行します。
セクション「8」にある「cron」のマニュアルを表示しろや!な指定です。
なお、セクションの指定は省略可能です。
省略した場合は1から順番に探してくれます。
マニュアルが複数ある場合は、より番号の若いセクションのマニュアルが表示されます。
man 8 cron
ではなく
man cron
でもマニュアルが表示されるのは、コンピュータさんが
man 1 cron
man 2 cron
man 3 cron
man 4 cron
man 5 cron
man 6 cron
man 7 cron
man 8 cron
man 9 cron
を順番に実行してくれているからです。
man 8 cron
を実行したときに「cron」のマニュアルが見つかります。
そこで切り上げて、見つけたマニュアルを表示してくれています。
