"man"으로 시작하기: 몇 가지 질문

"man"으로 시작하기: 몇 가지 질문

나는 남자와 문제가 있습니다:

  1. 맨페이지의 섹션을 어떻게 표시합니까? 매뉴얼 페이지가 어떤 섹션을 제공하는지 어떻게 알 수 있나요? 에 따르면 man man -S매뉴얼 페이지에서 사용 가능한 "섹션" 목록을 가져오는 데 필요한 매개변수입니다. 그러나 git, ls또는 pwdwith 의 사용 가능한 섹션을 표시하려고 하면 : man -S git. 나는 목록을 기대했지만 내가 얻는 것은 다음과 같습니다. 어떤 매뉴얼 페이지를 원하십니까?

  2. 또한 두 번째 질문이 있습니다. 매뉴얼 페이지의 짧은 버전/미리 보기를 어떻게 표시할 수 있습니까? 이것을 알아내는 것도 나의 임무이다. 내가 원하는 것과 일치하는 매개변수를 찾을 수 없습니다.

PS: 저는 MacOS Sierra에서 쉘을 사용하고 있습니다.

답변1

간단한 대답:

맨 페이지는 그렇지 않습니다포함하다섹션; 섹션에는 매뉴얼 페이지가 포함되어 있습니다.

이것은 당신이 말하는 번호가 매겨진 섹션을 나타냅니다. 이름은 같지만 두 개의 서로 다른(번호가 매겨진) 섹션에 두 개의 매뉴얼 페이지가 있을 수 있습니다(예: printf. 매뉴얼 printf(1)페이지에는 명령줄 도구가 포함되어 있습니다. 매뉴얼 printf(3)페이지에서는 C 함수 호출을 다룹니다.

다음을 실행하여 두 매뉴얼 페이지를 순서대로 볼 수 있습니다.

man -a printf

첫 번째를 종료하면 두 번째가 표시됩니다.

다음을 실행하면 열지 않고도 어떤 섹션에 나타나는지 확인할 수 있습니다.

man -aw printf

번호가 매겨진 섹션 외에도어느맨페이지가 존재하며, 개별 맨페이지도 나누어져 있습니다.시각적으로"이름", "개요", "설명" 등과 같은 별도의 헤더와 하위 헤더가 있습니다.

이것들은또한"섹션"이라고 부르지만 위에 설명된 번호가 매겨진 섹션과는 "섹션"이라는 단어의 사용법이 완전히 다릅니다.

답변2

예전에는 온라인 매뉴얼("인쇄본"과 대조되는 "온라인")에 8개의 섹션이 있었지만 나중에 더 많은 섹션이 추가되었습니다. 이 섹션은 1, 2, ..., 8이므로 다음과 같이 입력합니다.

man -S 4 xyz

섹션 4에서 xyz에 대한 매뉴얼 페이지를 얻으려면.

실제로 섹션을 지정하는 것은 둘 이상의 섹션에 동일한 키워드에 대한 매뉴얼 페이지가 있는 경우에만 중요합니다.

예를 들어:

man printf

수확량

PRINTF(1)                                                         User Commands

NAME
       printf - format and print data

SYNOPSIS
       printf FORMAT [ARGUMENT]...
       printf OPTION

DESCRIPTION
       Print ARGUMENT(s) according to FORMAT, or execute according to OPTION
...

~하는 동안

man -S 3 printf

수확량

PRINTF(3)                                                   Linux Programmer's Manual

NAME
       printf, fprintf, dprintf, sprintf, snprintf, vprintf, vfprintf, vdprintf, vsprintf, vsnprintf - formatted output conversion

SYNOPSIS
       #include <stdio.h>

       int printf(const char *format, ...);
       int fprintf(FILE *stream, const char *format, ...);
       int dprintf(int fd, const char *format, ...);
       int sprintf(char *str, const char *format, ...);
       int snprintf(char *str, size_t size, const char *format, ...);
...

다양한 섹션에 대한 소개를 보려면 = 1,2,3,...을 man -S x intro사용해 보세요 .x

때로는 다음과 같은 진술을 발견합니다.... fork(2)새 프로세스를 생성하는 데 사용됩니다. 이것은 종종 다음과 같습니다 execl(3)...이는 에 대한 매뉴얼 페이지가 fork섹션 2에 있고 에 대한 매뉴얼 페이지가 execl섹션 3에 있음을 나타냅니다.

맨페이지의 짧은 버전/미리보기를 어떻게 표시합니까?

이것이 무슨 뜻인지 잘 모르겠습니다. PowerShell man과 같은 기능을 제공하지 않습니다 . 다음과 같이 매우 짧은 설명을 제공합니다.Get-Helpwhatis

whatis man
man                  (1)  - format and display the on-line manual pages
man                  (1p)  - display system documentation
man                  (7)  - macros to format man pages
man []               (1)  - format and display the on-line manual pages
man []               (1p)  - display system documentation
man []               (7)  - macros to format man pages
man []               (7)  - pages - conventions for writing Linux man pages
man-pages            (7)  - conventions for writing Linux man pages
man.conf []          (5)  - configuration data for man
man.conf [man]       (5)  - configuration data for man

답변3

-S 인수는 원하는 작업을 수행하지 않습니다. 보고 싶은 매뉴얼 페이지의 범주를 지정하기 위한 것입니다.

매뉴얼 페이지의 섹션을 표시하는 자동화된 방법이 있다면 나는 그것을 모릅니다. 맨 페이지를 구문 분석하고 관심 있는 텍스트를 추출하려면 grep/sed/awk와 같은 도구를 사용하겠습니다. 즉, 다음과 같습니다.

man ls|grep -v -e '^$' -e '^[[:space:]]'

위의 코드는 완전한 솔루션이 아닙니다. 우선, 매뉴얼 페이지의 머리글과 바닥글도 인쇄합니다. 귀하의 요구 사항을 완전히 충족하도록 수정하거나 더 나은 구현을 생각해 낼 수 있다고 믿습니다.)

마찬가지로 맨페이지 "미리보기" 요청은 다음과 같이 쉽게 수행할 수 있습니다.출력 파이핑인간을 다른 도구로 바꾸는 것. 나는 추천하고 싶다머리그 일을 위해.

답변4

[1.]

나는 목록을 기대했지만 내가 얻는 것은 다음과 같습니다. 어떤 매뉴얼 페이지를 원하십니까?

-S섹션 목록을 표시하는 데 사용되지 않고 대신 섹션 목록을 전달하도록 요청합니다.원하는 구간 검색 순서. 예:

xb@dnxb:/tmp$ man -S=7,6,5,4,3,2 ls
No manual entry for ls
See 'man 7 undocumented' for help when manual pages are not available.
xb@dnxb:/tmp$ 

위의 내용은 -S=7,6,5,4,3,2이 목록에서 섹션 검색 순서가 왼쪽에서 오른쪽으로 시작됨을 보여줍니다. 설명서에 ls섹션 7이 포함되어 있으면 이를 표시합니다. 그렇지 않은 경우 섹션 6 등을 검색하려고 시도합니다. 이 목록 끝에 섹션이 없으면 "ls에 대한 수동 입력 없음"이라고 표시됩니다.섹션 1이 존재하더라도. 그러나 이것은 목록의 섹션 1 때문에 작동합니다.

xb@dnxb:/tmp$ man -S=7,6,5,4,3,2,1 ls
xb@dnxb:/tmp$ 

검색 순서가 -S왼쪽에서 오른쪽임을 증명하기 위해 이 두 가지를 가지고 놀아보세요.

xb@dnxb:/tmp$ man -S 1,1posix ls
xb@dnxb:/tmp$ man -S 1posix,1 ls
xb@dnxb:/tmp$ 

다음을 사용하지 않고도 정확한 섹션을 전달할 수도 있습니다 -S.

xb@dnxb:/tmp$ man 5 ls
No manual entry for ls in section 5
See 'man 7 undocumented' for help when manual pages are not available.
xb@dnxb:/tmp$ man 1posix ls
xb@dnxb:/tmp$

기본 순서는 여기에서 찾을 수 있으며(이 파일 경로는 에 설명되어 있음 man man) 왼쪽에서 오른쪽으로 검색 순서를 따릅니다.

xb@dnxb:/tmp$ \grep SECTION /etc/manpath.config
# the default is 1, n, l, 8, 3, 0, 2, 5, 4, 9, 6, 7. Multiple SECTION
SECTION         1 n l 8 3 2 3posix 3pm 3perl 5 4 9 6 7
xb@dnxb:/tmp$ 

맨페이지의 섹션을 어떻게 표시합니까? 매뉴얼 페이지가 제공하는 섹션을 어떻게 알 수 있습니까?

apropos [-e], whatis또는 사용 man -k:

xb@dnxb:/tmp$ apropos statvfs #OR man -k statvfs
fstatvfs (2)         - get filesystem statistics
fstatvfs (3)         - get filesystem statistics
fstatvfs (3posix)    - get file system information
statvfs (2)          - get filesystem statistics
statvfs (3)          - get filesystem statistics
statvfs (3posix)     - get file system information
statvfs.h (7posix)   - VFS File System information structure
sys_statvfs.h (7posix) - VFS File System information structure
xb@dnxb:/tmp$ apropos -e statvfs #OR whatis statvfs
statvfs (2)          - get filesystem statistics
statvfs (3)          - get filesystem statistics
statvfs (3posix)     - get file system information
xb@dnxb:/tmp$ 

[2.]

맨페이지의 짧은 버전/미리보기를 어떻게 표시합니까?

나는 항상 --help매뉴얼의 단축 버전을 보는 데 사용합니다(면책조항: 정확히 동일하지는 않음). 예:

xb@dnxb:/tmp$ mplayer --help
Usage:   mplayer [options] [url|path/]filename

Basic options: (complete list in the man page)
 -vo <drv>        select video output driver ('-vo help' for a list)
 -ao <drv>        select audio output driver ('-ao help' for a list)
 vcd://<trackno>  play (S)VCD (Super Video CD) track (raw device, no mount)
 dvd://<titleno>  play DVD title from device instead of plain file
 -alang/-slang    select DVD audio/subtitle language (by 2-char country code)
 -ss <position>   seek to given (seconds or hh:mm:ss) position
 -nosound         do not play sound
 -fs              fullscreen playback (or -vm, -zoom, details in the man page)
 -x <x> -y <y>    set display resolution (for use with -vm or -zoom)
 -sub <file>      specify subtitle file to use (also see -subfps, -subdelay)
 -playlist <file> specify playlist file
 -vid x -aid y    select video (x) and audio (y) stream to play
 -fps x -srate y  change video (x fps) and audio (y Hz) rate
 -pp <quality>    enable postprocessing filter (details in the man page)
 -framedrop       enable frame dropping (for slow machines)

Basic keys: (complete list in the man page, also check input.conf)
 <-  or  ->       seek backward/forward 10 seconds
 down or up       seek backward/forward  1 minute
 pgdown or pgup   seek backward/forward 10 minutes
 < or >           step backward/forward in playlist
 p or SPACE       pause movie (press any key to continue)
 q or ESC         stop playing and quit program
 + or -           adjust audio delay by +/- 0.1 second
 o                cycle OSD mode:  none / seekbar / seekbar + timer
 * or /           increase or decrease PCM volume
 x or z           adjust subtitle delay by +/- 0.1 second
 r or t           adjust subtitle position up/down, also see -vf expand

 * * * SEE THE MAN PAGE FOR DETAILS, FURTHER (ADVANCED) OPTIONS AND KEYS * * *

MPlayer 1.3.0 (Debian), built with gcc-5.4.0 (C) 2000-2016 MPlayer Team
xb@dnxb:/tmp$ 

관련 정보