Opensourcetechブログ

OpensourcetechによるNGINX/Kubernetes/Zabbix/Neo4j/Linuxなどオープンソース技術に関するブログです。

manコマンド(マニュアル)について

 

こんにちは、LinuCエバンジェリストこと、鯨井貴博@opensourcetechです。

 

今回は、manコマンド(マニュアル参照)について簡単にまとめてみます。

 

 

manコマンド

以下のリンクにあるように、コマンドの使い方/オプション・ファイルフォーマットなど様々なことを知ることが出来るものです。

Man page of man

 

困ったら、「man」というやつですね。

 

 

manで参照できる情報

 manを実行した場合には、数字やアルファベットなど 出力情報の種類を表すセクション番号というものがあります。

以下の例では、「(8)」という部分です。

※man sysctlの例。

SYSCTL(8)                                                                                           SYSCTL(8)

名前
sysctl - 実行時にカーネルパラメータを設定する

書式
sysctl [-n] [-e] variable ...
sysctl [-n] [-e] [-q] -w variable=value ...
sysctl [-n] [-e] [-q] -p <filename>
sysctl [-n] [-e] -a
sysctl [-n] [-e] -A

説明
sysctl はカーネルのパラメータを実行時に修正するのに用いる。変更できるパ
ラメータは /proc/sys/ 以下にリストされているものである。 Linux における
sysctl の機能には procfs が必要である。 sysctl は sysctl データの読み書
き両方に使える。

 

 セクション番号は、以下のように決められており、

「(8)」はシステム管理用のコマンドに関するマニュアルであることがわかります。

1 実行プログラムまたはシェルのコマンド
2 システムコール (カーネルが提供する関数)
3 ライブラリコール (システムライブラリに含まれる関数)
4 特殊なファイル (通常 /dev に置かれているもの)
5 ファイルのフォーマットと約束事。例えば /etc/passwd など
6 ゲーム
7 マクロのパッケージとその約束事。例えば man(7), groff(7) など
8 システム管理用のコマンド
9 カーネルルーチン [非標準]
n 新しいもの [最近では使われない]
l システムローカルなもの [最近では使われない]
p パブリックなもの [最近では使われない]
o 古いもの [最近では使われない]

 

 

man実行に必要なパッケージ

CentOSの場合ですが、以下のパッケージが導入されていれば、manコマンドを実行することが出来ます。

・man(CentOS7では、man-db)

・man-pages(日本語版はman-pages-ja、その他言語用もman-pages-**)

 

CentOS6

[root@CentOS6 ~]# rpm -ql man
/etc/cron.daily/makewhatis.cron
/etc/man.config
/usr/bin/apropos
/usr/bin/man <-------manコマンド
/usr/bin/man2html
/usr/bin/manpath
/usr/bin/whatis
/usr/libexec/man-cmp.sh
/usr/sbin/makewhatis
.
.
省略
.
.
[root@CentOS6 ~]# yum search man-
読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
* base: ftp.iij.ad.jp
* extras: ftp.iij.ad.jp
* updates: ftp.iij.ad.jp
============================== N/S Matched: man- ===============================
man-pages-fr.noarch : French version of the Linux man-pages <-------フランス語
ctan-cm-lgc-roman-fonts.noarch : CM-LGC Type 1 fonts, serif font faces
libwsman-devel.i686 : Open-source Implementation of WS-Management
libwsman-devel.x86_64 : Open-source Implementation of WS-Management
man-pages.noarch : Man (manual) pages from the Linux Documentation Project <-------英語
man-pages-cs.noarch : Czech man pages from the Linux Documentation Project <-------チェコ語
man-pages-es.noarch : Spanish man pages from the Linux Documentation Project <-------スペイン語
man-pages-es-extra.noarch : Extra manual pages - Spanish versions
man-pages-it.noarch : Italian man (manual) pages from the Linux Documentation
: Project <-------イタリア語
man-pages-ja.noarch : Japanese man (manual) pages from the Japanese Manual
: Project <-------日本語
man-pages-ko.noarch : Korean(Hangul) Man(manual) Pages from the Korean Manpage <-------韓国語(ハングル)
: Project
man-pages-overrides.noarch : Complementary and updated manual pages
man-pages-pl.noarch : Polish man pages from the Linux Documentation Project
man-pages-ru.noarch : Russian man pages from the Linux Documentation Project
man-pages-uk.noarch : Ukrainian man pages from the Linux Documentation Project
.
.
省略
.
.

 

CentOS7

[root@localhost ~]# rpm -ql man-db
/etc/cron.daily/man-db.cron
/etc/man_db.conf
/etc/sysconfig/man-db
/usr/bin/apropos
/usr/bin/catman
/usr/bin/lexgrog
/usr/bin/man <-------manコマンド
/usr/bin/mandb
/usr/bin/manpath
/usr/bin/whatis
.
.
省略
.
.
[root@localhost ~]# yum search man-
読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
* base: ftp.iij.ad.jp
* extras: ftp.iij.ad.jp
* updates: ftp.iij.ad.jp
============================== N/S matched: man- ===============================
man-pages-fr.noarch : French version of the Linux man-pages
byteman-javadoc.noarch : Javadocs for byteman
libguestfs-man-pages-ja.noarch : Japanese (ja) man pages for libguestfs
libguestfs-man-pages-uk.noarch : Ukrainian (uk) man pages for libguestfs
libmodman-devel.i686 : Development files for libmodman
libmodman-devel.x86_64 : Development files for libmodman
libwsman-devel.i686 : Open source Implementation of WS-Management
libwsman-devel.x86_64 : Open source Implementation of WS-Management
man-db.x86_64 : Tools for searching and reading man pages
man-pages.noarch : Man (manual) pages from the Linux Documentation Project
man-pages-cs.noarch : Czech man pages from the Linux Documentation Project
man-pages-es.noarch : Spanish man pages from the Linux Documentation Project
man-pages-es-extra.noarch : Extra manual pages - Spanish versions
man-pages-it.noarch : Italian man (manual) pages from the Linux Documentation
: Project
man-pages-ja.noarch : Japanese man (manual) pages from the Japanese Manual
: Project
man-pages-ko.noarch : Korean(Hangul) Man(manual) Pages from the Korean Manpage
: Project
man-pages-overrides.x86_64 : Complementary and updated manual pages
man-pages-pl.noarch : Polish man pages from the Linux Documentation Project
man-pages-ru.noarch : Russian man pages from the Linux Documentation Project
man-pages-zh-CN.noarch : Chinese Man Pages from Chinese Man Pages Project
openwsman-client.i686 : Openwsman Client libraries
openwsman-client.x86_64 : Openwsman Client libraries
openwsman-perl.x86_64 : Perl bindings for openwsman client API
openwsman-python.x86_64 : Python bindings for openwsman client API
.
.
省略
.
.

 

 

manの実行

セクション番号を付与してコマンドを実行する場合、以下のようにします。

[root@CentOS6 ~]# man 2 sysctl
[root@CentOS6 ~]# man 3 sysctl
No entry for sysctl in section 3 of the manual <-------該当するものなし
[root@CentOS6 ~]# man 5 sysctl.conf

 

 

 

www.slideshare.net

github.com

www.facebook.com

twitter.com

www.instagram.com

 

 

にほんブログ村 IT技術ブログ Linuxへ
Linux

にほんブログ村 IT技術ブログ オープンソースへ
オープンソース

 

 

Opensourcetech by Takahiro Kujirai