8
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Linux で man コマンドのセクション番号が何か調べるには manual を見る

Last updated at Posted at 2019-08-07

なに?

printf(1), printf(3) みたいな括弧内に数字が振られている表現は manual のセクション番号を意味している。
manual のセクション番号 1 ってなんだっけ?となった場合、 man man で確認すると良い。
ブラウザ使える環境があるなら https://www.kernel.org/doc/man-pages/ 見ても良い。

$ man man

表示例

MAN(1)                                                                      Manual pager utils                                                                      MAN(1)

NAME
       man - an interface to the on-line reference manuals

SYNOPSIS
       man  [-C  file]  [-d]  [-D]  [--warnings[=warnings]]  [-R  encoding]  [-L locale] [-m system[,...]] [-M path] [-S list] [-e extension] [-i|-I] [--regex|--wildcard]
       [--names-only] [-a] [-u] [--no-subpages] [-P pager]  [-r  prompt]  [-7]  [-E  encoding]  [--no-hyphenation]  [--no-justification]  [-p  string]  [-t]  [-T[device]]
       [-H[browser]] [-X[dpi]] [-Z] [[section] page ...] ...
       man -k [apropos options] regexp ...
       man -K [-w|-W] [-S list] [-i|-I] [--regex] [section] term ...
       man -f [whatis options] page ...
       man  -l [-C file] [-d] [-D] [--warnings[=warnings]] [-R encoding] [-L locale] [-P pager] [-r prompt] [-7] [-E encoding] [-p string] [-t] [-T[device]] [-H[browser]]
       [-X[dpi]] [-Z] file ...
       man -w|-W [-C file] [-d] [-D] page ...
       man -c [-C file] [-d] [-D] page ...
       man [-?V]

DESCRIPTION
       man is the system's manual pager. Each page argument given to man is normally the name of a program, utility or function.  The manual page associated with each  of
       these  arguments  is then found and displayed. A section, if provided, will direct man to look only in that section of the manual.  The default action is to search
       in all of the available sections, following a pre-defined order and to show only the first page found, even if page exists in several sections.

       The table below shows the section numbers of the manual followed by the types of pages they contain.

       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]

       A manual page consists of several sections.

これは Amazon Linux 2 環境で実行した例

[ec2-user@ip-172-31-23-244 ~]$ cat /etc/*release
NAME="Amazon Linux"
VERSION="2"
ID="amzn"
ID_LIKE="centos rhel fedora"
VERSION_ID="2"
PRETTY_NAME="Amazon Linux 2"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2"
HOME_URL="https://amazonlinux.com/"
Amazon Linux release 2 (Karoo)

以下のようなセクション番号構成であることがわかる

番号 原文 拙訳
1 Executable programs or shell commands 実行可能なプログラム or シェルコマンド
2 System calls (functions provided by the kernel) システムコール (カーネルから提供される機能)
3 Library calls (functions within program libraries) ライブラリ呼び出し(プログラムライブラリの関数)
4 Special files (usually found in /dev) スペシャルファイル (通常 /dev にあるもの)
5 File formats and conventions eg /etc/passwd ファイルフォーマットと慣例。例: /etc/passwd
6 Games ゲーム
7 Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7) 色々。マクロパッケージとか慣例とか。例: man(7), groff(7)
8 System administration commands (usually only for root) システム管理者コマンド群 (通常 root 向けのもの)
9 Kernel routines [Non standard] カーネルルーティン

Mac の場合

BSD だと man man しても書いてなかった・・・

3.12. Manual Pages
https://www.freebsd.org/doc/handbook/basics-more-information.html

番号 原文 拙訳
1 User commands. ユーザーコマンド
2 System calls and error numbers. システムコールとエラー番号
3 Functions in the C libraries. C ライブラリの関数
4 Device drivers. デバイスドライバ
5 File formats. ファイルフォーマット
6 Games and other diversions. ゲームと他のディバージョン
7 Miscellaneous information. その他の情報
8 System maintenance and operation commands. システムのメンテナンスと走査コマンド群
9 System kernel interfaces. システムカーネルインターフェイス

※ ディバージョンがなんだかよく分からず

8
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?