manとはUNIX系のOSに付属するマニュアルページのことです。あまり使う習慣がなかったのですが、コマンドの使い方がわからない時など、まずmanで調べることが基本かなと思ったので改めて確認しました。
manインストール
[root@localhost ~]# yum install man
CentOS 6をminimalでインストールした場合はmanは含まれていないので、manをインストールします。
whatisデータベース作成
[root@localhost ~]# makewhatis
調べたいマニュアルがどのセクションにあるかキーワード検索するために、キーワード検索用のデータベースを作成しておく必要があるため、makewhatisコマンドを実行しておきます。
manコマンドの書式
man [オプション] [セクション] コマンド名/キーワード
| オプション | 説明 |
| -a | すべてのセクションのマニュアルを表示する |
| -f | キーワード検索(完全一致)してマニュアルがどのセクションにあるか確認する/whatisコマンドと同じ |
| -k | キーワード検索(部分一致)してマニュアルがどのセクションにあるか確認する/aproposコマンドと同じ |
| -w | マニュアルのパス表示 |
デフォルトはlessで表示されます。
例)iptablesコマンドのマニュアル表示
[root@localhost ~]# man iptables
IPTABLES(8) iptables 1.4.7 IPTABLES(8)
NAME
iptables — administration tool for IPv4 packet filtering and NAT
SYNOPSIS
iptables [-t table] {-A|-D} chain rule-specification
iptables [-t table] -I chain [rulenum] rule-specification
iptables [-t table] -R chain rulenum rule-specification
...(以下省略)...
セクション
| セクション | 説明 |
| 1 | ユーザコマンド |
| 2 | システムコール |
| 3 | ライブラリ |
| 4 | デバイスファイル |
| 5 | ファイルフォーマット |
| 6 | ゲーム |
| 7 | その他 |
| 8 | システム管理者コマンド |
| 9 | LINUX独自のカーネル用ドキュメント |
マニュアルが複数のセクションにあり、セクションを指定しない場合は、最初に見つかったセクションのマニュアルが表示されます。
例)crontabコマンドのマニュアルがどのセクションにあるか検索
[root@localhost ~]# man -f crontab crontab (1) - maintain crontab files for individual users crontab (5) - tables for driving cron (ISC Cron V4.1)
例)crontabのセクション5のマニュアルを見る
[root@localhost ~]# man 5 crontab
ANACRONTAB(5) Cronie Users’ Manual ANACRONTAB(5)
NAME
crontab - tables for driving cron (ISC Cron V4.1)
DESCRIPTION
A crontab file contains instructions to the cron(8) daemon of the general form: "run this command at this time on this date". Each user has their own crontab, and
commands in any given crontab will be executed as the user who owns the crontab. Uucp and News will usually have their own crontabs, eliminating the need for
explicitly running su(1) as part of a cron command.
...(以下省略)...
参照