MAN 페이지 - 윈디하나의 솔라나라
|
맨 페이지(man pages)라는 참조 매뉴얼(reference manual pages)이 있다. 쉽게 말해 도움말이다. 유닉스 커맨드 뿐만 아니라 유닉스 전반을 모두 다루고 있고, 별도의 문서를 보지 않고 맨페이지만 봐도 내용을 모두 알 수 있도록 방대한 내용을 다루고 있다.
M이 의미하는게 매뉴얼이고 참조 매뉴얼을 말하기도 하며, 결국 맨 페이지를 의미한다.
man SEARCHWORD
를 입력하면 찾고자 하는 맨페이지를 보여준다. 맨 페이지를 볼 때 사용할 수 있는 키는 less(1) (솔라리스 11부터) 또는 more(1) (솔라리스 10까지) 에서 사용하는 키와 같다. (사용 가능한 키에 대해서는 다음 섹션에서 설명한다)
root@wl ~ # man standards 페이지를 다시 포맷 중입니다. 기다려 주십시오... 완료 Standards, Environments, and Macros standards(5) NAME standards, ANSI, C, C++, ISO, POSIX, POSIX.1, POSIX.2, SUS, SUSv2, SUSv3, SVID, SVID3, XNS, XNS4, XNS5, XPG, XPG3, XPG4, XPG4v2 - standards and specifications supported by Oracle Solaris DESCRIPTION Oracle Solaris supports IEEE Std 1003.1 and IEEE Std 1003.2, commonly known as POSIX.1 and POSIX.2, respectively. The following table lists each version of these standards with a brief description and the SunOS or Solaris release that first conformed to it. POSIX Standard Description Release ______________________________________________________________________ POSIX.1-1988 system interfaces and headers SunOS 4.1 ______________________________________________________________________ POSIX.1-1990 POSIX.1-1988 update Solaris 2.0 ______________________________________________________________________ POSIX.1b-1993 realtime extensions Solaris 2.4 ______________________________________________________________________ POSIX.1c-1996 threads extensions Solaris 2.6 ______________________________________________________________________ POSIX.2-1992 shell and utilities Solaris 2.5 ______________________________________________________________________ POSIX.2a-1992 interactive shell and utilities Solaris 2.5 ______________________________________________________________________ POSIX.1-2001 POSIX.1-1990, POSIX.1b-1993, Solaris 10 POSIX.1c-1996, POSIX.2-1992, and POSIX.2a-1992 updates ______________________________________________________________________ POSIX.1-2004 POSIX.1-2001 update Oracle Solaris 11 ______________________________________________________________________ POSIX.1-2008 POSIX.1-2004 update Oracle Solaris 11 Oracle Solaris also supports the X/Open Common Applications Environment (CAE) Portability Guide Issue 3 (XPG3) and Issue 4 (XPG4); Single UNIX Specification (SUS, also known as XPG4v2); Single UNIX Specification, Version 2 (SUSv2); and Single UNIX Specification, Version 3 (SUSv3). Both XPG4 and SUS include Networking Services Issue 4 (XNS4). SUSv2 includes Networking Services Issue 5 (XNS5). ... q root@wl ~ #
페이지 보기시 사용 가능한 키는 페이저(Pager) 설정에 따라 달라진다. 페이저 설정은 PAGER
환경 변수에 설정하는데, 솔라리스 10까지는 more -s
커맨드를, 솔라리스 11이나 리눅스에서는 less -ins
커맨드를 사용한다.
more -s
페이저에서 사용 가능한 키
스페이스바 ▷ 다음 페이지로 스크롤 /정규표현식 ▷ 정규표현식을 찾음 b ▷ 이전 페이지로 스크롤 f ▷ 다음 페이지로 스크롤 q ▷ 종료 h ▷ 도움말(사용가능한 커맨드 보임)더 자세한 사항은 more(1)을 참고하자.
less -ins
페이저에서 사용 가능한 키
스페이스바 ▷ 다음 페이지로 스크롤 /정규표현식 ▷ 정규표현식을 찾음 b ▷ 이전 페이지로 스크롤 f ▷ 다음 페이지로 스크롤 q ▷ 이전화면으로 되돌린 후 종료 h ▷ 도움말(사용가능한 커맨드 보임)더 자세한 사항은 less(1)을 참고하자.
more
나, less
나 기본적인 사용방법은 같다.
root@wl ~ # man intro 1) ... root@wl ~ # man -s 5 intro 2) ... root@wl ~ # man intro.5 2) ... root@wl ~ #1) intro 라는 키워드는 각 섹션마다 존재하며, 섹션 검색 순서에 따라 먼저 검색된 맨 페이지를 보여준다. 따라서 섹션 1에 대한 intro 맨 페이지가 보여질 것이다.
-s
인자를 통해 전해야 한다.
root@wl ~ # man xhost
xhost에 대한 설명서 항목이 없습니다.
root@wl ~ # man -M /usr/openwin/share/man xhost 1)
페이지를 다시 포맷 중입니다. 기다려 주십시오... 완료
X Version 11 XHOST(1)
NAME
xhost - server access control program for X
...
root@wl ~ #
1) xhost(1) 는 openwin 의 명령어로 솔라리스에서 사용 가능하지만, 맨페이지는 검색되지 않는다. man(1) 은 별도의 설정을 하지 않는한 (하단의 MANPATH
환경변수 참조) /usr/share/man
디렉토리만 검색하기 때문이다. 따라서 xhost 맨 페이지가 없는 것으로 나온다. -M
옵션을 사용해 디렉토리를 지정하면 맨 페이지를 볼 수 있다.
임의의 디렉토리에 저장되어있는 맨 페이지 파일을 보려면 아래와 같이 nroff(1) 와 more(1) 를 이용 해야 한다.
root@wl /usr/openwin/share/man # nroff -man xhost.1 | more -s ...
맨 페이지를 일반 텍스트로 전환하는 방법은 많지만 col(1) 명령어를 사용하는 방법도 있어 소개한다. (man(1)에 설명되어있다)
root@wl ~ # man pipe.2 | col -x -b
특정 키워드를 가진 맨 페이지를 찾으려면 -f
옵션과 -k
옵션을 사용해야 한다. 자세한 사항은 이 문서 하단의 whatis(1) 와 apropos(1) 를 참조한다.
MANPATH
는 꼭 알아두어야 한다.
MANPATH
: 맨페이지 파일이 있는 디렉토리 이름. 콜론(:)으로 구분된 디렉토리명을 입력한다. 기본값은 /usr/share/man
이며 MANPATH
가 세팅되어있으면 그 값을 사용한다. 아울러 /usr/share/man/man.cf
파일에 나오는 섹션 순서대로 주어진 이름을 찾는다. 커맨드에서 -M이나 -s옵션을 사용해 이 값을 임시로 변경할 수 있다.PAGER
: 페이징 파일. 기본값은 more -s
또는 /usr/bin/less -ins
TCAT
: troffed 매뉴얼 페이지를 디스플레이할 프로그램. 기본값은 lpr -t
.TROFF
: -t 플래그를 줬을때 사용할 troff형식의 파일 포매터(formatter).whatis(1)은 주어진 구문에 해당하는 맨 페이지를 모두 찾아 보여준다. 주로 해당 맨 페이지가 어떤 섹션들에 들어있는지 확인하는 용도로 사용한다. 이 명령은 man -f
와 같다.
예를 들어 smf
는 아래와 같이 3rad
와 5
섹션에 있다.
windy@wl ~ $ man -f smf 1. smf(3rad) NAME /usr/man/man3rad/smf.3rad smf 2. smf(5) NAME /usr/man/man5/smf.5 smf - service management facility windy@wl ~ $ whatis smf 1. smf(3rad) NAME /usr/man/man3rad/smf.3rad smf 2. smf(5) NAME /usr/man/man5/smf.5 smf - service management facility
NAME절에 들어있는 페이지를 가진 맨 페이지 키워드를 검색해 출력한다.
man -k
와 같다.
windy@maid ~ $ man -k smf 1. smf(5) /usr/man/man5/smf.5 smf - service management facility ... 14. smf_bootstrap(5) /usr/man/man5/smf_bootstrap.5 smf_bootstrap - service management facility boot, packaging, and compatibility behavior windy@wl ~ $ apropos smf 1. smf(5) /usr/man/man5/smf.5 smf - service management facility ... 14. smf_bootstrap(5) /usr/man/man5/smf_bootstrap.5 smf_bootstrap - service management facility boot, packaging, and compatibility behavior
-w
파라메터를 사용해 windex
파일을 만들거나 갱신할 때 사용한다./usr/share/man/windex: No such file or directory
라는 메시지가 나오면 아래와 같이 실행한다.
root@wl ~ # /usr/bin/catman -w
MAN페이지의 작성 방법에 대해 설명한다. 구체적인 작성 방법은 man(5)에 설명되어있다.
MAN페이지 작성은 아래와 같이 두 단계로 이루어진다.
매크로 파일은 기본적으로 roff 라는 고전적인 유닉스용 텍스트 포매팅 프로그램의 문법을 따른다. 이후 이를 개량한 nroff 나 troff 가 나왔는데, 여기서는 오늘날에 주로 사용하는 nroff 를 사용한 예시를 보인다.
가장 먼저 man페이지에 들어갈 매크로 파일을 작성해야 한다. 작성한 파일은 nroff(1)에 의해 해석되기 때문에, NROFF 포맷에 맞춰 작성해야 한다. MAN페이지에 흔히 사용되는 매크로는 아래 샘플을 참조하자. nroff(1)에 사용 가능한 모든 매크로가 나와있으니 한번 읽어보자.
mansample.txt | (329 바이트) |
.\" This is a comment. .TH MANSAMPLE 1 "2018-01" "SunOS 5.11" "User Manual" .SH NAME mansample \- mansample script .SH SYNOPSIS .B mansample .SH DESCRIPTION .B mansample is textfile for generating sample man pages. You can refer to .BR man(5) man pages. .SH "SEE ALSO" .BR man(5) .SH AUTHOR .I WindyHana <windyhana@solanara.net>
MAN 페이지 형식에 맞춰 작성한 매크로 파일은 nroff(1)을 사용해 MAN 페이지 형식으로 변환할 수 있다.
windy@wl ~ $ mkdir man1 windy@wl ~ $ cd man1 windy@wl ~/man1 $ nroff -man mansample.txt > mansample.1 windy@wl ~/man1 $ cd .. windy@wl ~ $ man -M `pwd` mansample Reformatting page. Please Wait... done MANSAMPLE(1) User Manual MANSAMPLE(1) NAME mansample - mansample script SYNOPSIS mansample DESCRIPTION mansample is textfile for generating sample man pages. You can refer to man(5) man pages. SEE ALSO man(5) AUTHOR WindyHana <windyhana@solanara.net> SunOS 5.11 2018-01 MANSAMPLE(1) q windy@wl ~ $
기울여 쓰기, 굵게 쓰기는 사용하는 터미널에 따라 다르게 보인다. 예를 들어 윈도버전의 putty
는 기본값으로 기울여 쓰기는 언더바로, 굵게 쓰기는 흰색으로 표시한다. 아래와 유사하게 보인다.
MANSAMPLE(1) User Manual MANSAMPLE(1) NAME mansample - mansample script SYNOPSIS mansample DESCRIPTION mansample is textfile for generating sample man pages. You can refer to man(5) man pages. SEE ALSO man(5) AUTHOR WindyHana <windyhana@solanara.net> SunOS 5.11 2018-01 MANSAMPLE(1)
RSS ATOM XHTML 5 CSS3 |
Copyright © 2004-2025 Jo HoSeok. All rights reserved. |