맨페이지에서 Unix 명령 이름 뒤에 표시된 괄호 안의 숫자는 무엇을 의미합니까? (What does the number in parentheses shown after Unix command names in manpages mean?)


문제 설명

맨페이지에서 Unix 명령 이름 뒤에 표시된 괄호 안의 숫자는 무엇을 의미합니까? (What does the number in parentheses shown after Unix command names in manpages mean?)

예: man(1), find(3), updatedb(2)?

괄호 안의 숫자(영국식 "대괄호")는 무엇을 의미합니까?


참조 솔루션

방법 1:

It's the section that the man page for the command is assigned to.

These are split as

  1. General commands
  2. System calls
  3. C library functions
  4. Special files (usually devices, those found in /dev) and drivers
  5. File formats and conventions
  6. Games and screensavers
  7. Miscellanea
  8. System administration commands and daemons

Original descriptions of each section can be seen in the Unix Programmer's Manual (page ii).

In order to access a man page given as "foo(5)", run:

man 5 foo

방법 2:

The section the command is documented in the manual. The list of sections is documented on man's manual. For example:

man 1 man
man 3 find

This is useful for when similar or exactly equal commands exist on different sections

방법 3:

The reason why the section numbers are significant is that many years ago when disk space was more of an issue than it is now the sections could be installed individually.

Many systems only had 1 and 8 installed for instance. These days people tend to look the commands up on google instead.

방법 4:

As @Ian G says, they are the man page sections. Let's take this one step further though:

1. See the man page for the man command with man man, and it shows the 9 sections as follows:

DESCRIPTION
       man  is  the system's manual pager. Each page argument given
       to man is normally the name of a program, utility  or  func‐
       tion.   The  manual page associated with each of these argu‐
       ments 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 sec‐
       tions following a pre‑defined order ("1 n l 8 3 2 3posix 3pm
       3perl 5 4 9 6 7" by default, unless overridden by  the  SEC‐
       TION directive in /etc/manpath.config), 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 fol‐
       lowed 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  conven‐
           tions), 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.


2. man <section_num> <cmd>

Let's imagine you are Googling around for Linux commands. You find the OPEN(2) pg online: open(2) — Linux manual page.

To see this in the man pages on your pc, simply type in man 2 open.

For FOPEN(3) use man 3 fopen, etc.

3. man <section_num> intro

To read the intro pages to a section, type in man <section_num> intro, such as man 1 intro, man 2 intro, man 7 intro, etc.

To view all man page intros in succession, one‑after‑the‑other, do man ‑a intro. The intro page for Section 1 will open. Press q to quit, then press Enter to view the intro for Section 8. Press q to quit, then press Enter to view the intro for Section 3. Continue this process until done. Each time after hitting q, it'll take you back to the main terminal screen but you'll still be in an interactive prompt, and you'll see this line:

‑‑Man‑‑ next: intro(8) [ view (return) | skip (Ctrl‑D) | quit (Ctrl‑C) ]

Note that the Section order that man ‑a intro will take you through is:

  1. Section 1
  2. Section 8
  3. Section 3
  4. Section 2
  5. Section 5
  6. Section 4
  7. Section 6
  8. Section 7

This search order is intentional, as the man man page explains:

The default action is to search in all of the available sections follow‐
ing a pre‑defined order ("1 n l 8 3 2 3posix 3pm 3perl 5 4 9 6 7" by default, unless overrid‐
den  by the SECTION directive in /etc/manpath.config)

Why did they choose this order? I don't know (please answer in the comments if you know), but just realize this order is correct and intentional.

Related:

  1. Google search for "linux what does the number mean in parenthesis after a function?"
  2. SuperUser: What do the parentheses and number after a Unix command or C function mean?
  3. Unix & Linux: What do the numbers in a man page mean?

방법 5:

Note also that on other unixes, the method of specifying the section differs. On solaris, for example, it is:

man ‑s 1 man

(by duckyflipIan GVinko VrsalovicLepardUKGabriel StaplesTREE)

참조 문서

  1. What does the number in parentheses shown after Unix command names in manpages mean? (CC BY‑SA 2.5/3.0/4.0)

#manpage #command-line #unix #linux






관련 질문

터미널에서 XCode docset 문서 보기 (View XCode docset docs from terminal)

Linux/Darwin/RST/POD가 아닌 STDIN의 MAN 형식 파일 또는 변수 표시 (Show MAN formatted file or variable from STDIN in Linux/Darwin / NOT with RST/POD)

mac 터미널에서 중복된 결과를 반환하는 "man" 명령 ("man" command returning duplicated results in mac terminal)

맨페이지에서 Unix 명령 이름 뒤에 표시된 괄호 안의 숫자는 무엇을 의미합니까? (What does the number in parentheses shown after Unix command names in manpages mean?)

맨페이지 scandir() 프로토타입 이상함 (Manpage scandir() prototype weirdness)

일부 Linux 시스템 호출에 두 개의 매뉴얼 페이지가 있는 이유는 무엇입니까? (Why do some Linux system calls have two man pages?)

brew에 의해 업그레이드된 nmap 이후 man nmap은 횡설수설합니다. (man nmap goes gibberish after nmap upgraded by brew)

남자: /usr/share/man/man3/std::basic_iostream.3cxx를 열 수 없습니다: 해당 파일이나 디렉터리가 없습니다 (man: can't open /usr/share/man/man3/std::basic_iostream.3cxx: No such file or directory)

매뉴얼 페이지의 개요에 나열된 헤더 중 일부 또는 전체를 포함해야 합니까? (Should I include any or all of the headers listed in the synopsis of a man page?)

맨 섹션 (man sections)

공통 lisp에 대한 Man 또는 javadoc 스타일 문서 (Man or javadoc-style documentation for common lisp)

Texinfo 문서는 어디에서 찾을 수 있습니까? (Where can I find Texinfo documentation?)







코멘트