웹사이트 검색

초보자를 위한 Linux manpath 명령 자습서(예제 5개)


이 페이지에서

  1. Linux manpath 튜토리얼
  2. Q1. manpath 명령은 어떻게 작동합니까?\n
  3. Q2. manpath 대신 출력에 catpath를 사용하는 방법은 무엇입니까?\n
  4. Q3. manpath 인쇄 디버깅 정보를 만드는 방법은 무엇입니까?
  5. Q4. manpath가 다른 OS 수동 계층에 액세스하는 방법은 무엇입니까?\n
  6. Q5. manpath가 사용자 지정 구성 파일을 사용하도록 만드는 방법은 무엇입니까?\n
  7. 결론

Linux의 매뉴얼 페이지는 명령줄 유틸리티와 관련하여 첫 번째 수준의 지원을 제공합니다. 대부분의 사용자가 알고 있듯이 man [command-name]을 입력하면 해당 매뉴얼 페이지가 나타납니다. 하지만 이 매뉴얼 페이지가 검색되는 경로를 알고 있습니까?

이 튜토리얼에서는 이 정보를 보여주는 유틸리티인 manpath에 대해 설명합니다. 그러나 설명을 시작하기 전에 여기에 있는 모든 예제는 Ubuntu 18.04 LTS 시스템에서 테스트되었음을 언급할 가치가 있습니다.

리눅스 맨패스 튜토리얼

Linux의 manpath 명령은 매뉴얼 페이지의 검색 경로를 결정하는 데 도움이 됩니다. 구문은 다음과 같습니다.

manpath [-qgdc?V] [-m system[,...]] [-C file]

도구 설명서 페이지에서 설명하는 방법은 다음과 같습니다.

       If  $MANPATH is set, manpath will simply display its contents and issue
       a warning.  If not, manpath will determine a suitable manual page hier?
       archy search path and display the results.

       The  colon-delimited  path  is determined using information gained from
       the man-db configuration file - (/etc/manpath.config)  and  the  user's
       environment.

다음은 manpath 명령이 작동하는 방식에 대한 좋은 아이디어를 제공하는 Q&A 형식의 예입니다.

Q1. manpath 명령은 어떻게 작동합니까?

기본 사용법은 매우 간단합니다. manpath sans 옵션을 실행하기만 하면 됩니다.

manpath

예를 들어 위의 명령이 내 시스템의 출력에서 생성한 내용은 다음과 같습니다.

/usr/local/man:/usr/local/share/man:/usr/share/man

보시다시피 manpath는 콜론으로 구분된 매뉴얼 페이지 경로 목록을 생성합니다.

man-db 구성 파일 내에서 global로 명명된 모든 경로로 구성된 manpath를 생성하려는 경우 -g 명령줄 옵션을 사용할 수 있습니다.

Q2. manpath 대신 출력에 catpath를 사용하는 방법은 무엇입니까?

이를 위해 -c 명령줄 옵션을 사용합니다.

manpath -c

도구 설명서 페이지에서 이 작업을 설명하는 방법은 다음과 같습니다.

Once the manpath is determined, each path element is converted to its relative catpath.

예를 들어 내 시스템에서 생성된 출력은 다음과 같습니다.

/var/cache/man/oldlocal:/var/cache/man/local:/var/cache/man

Q3. manpath 인쇄 디버깅 정보를 만드는 방법은 무엇입니까?

이를 위해 -d 명령줄 옵션을 사용합니다.

manpath -d

예를 들어 이 명령이 내 시스템에서 생성한 출력은 다음과 같습니다.

동의합니다. 이 옵션을 자주 사용하지 않을 수 있지만 도구 출력을 디버그해야 하는 경우 최소한 알고 있어야 합니다.

Q4. manpath가 다른 OS 수동 계층에 액세스하는 방법은 무엇입니까?

이를 위해 -m 명령줄 옵션을 사용합니다. 도구 매뉴얼 페이지에서 이 옵션을 설명하는 방법은 다음과 같습니다.

-m system[,...], --systems=system[,...]
             
If  this  system  has access to other operating sys?
              tem's manual hierarchies, this option can be used to
              include  them  in the output of manpath.  To include
              NewOS's manual page hierarchies use  the  option  -m
              NewOS.

              The  system  specified can be a combination of comma
              delimited operating system names.   To  include  the
              native  operating  system's manual page hierarchies,
              the system name man must be included in the argument
              string.  This option will override the $SYSTEM envi?
              ronment variable.

Q5. manpath가 사용자 지정 구성 파일을 사용하도록 만드는 방법은 무엇입니까?

기본적으로 manpath는 다음 파일에서 정보를 가져옵니다.

/etc/manpath.config

그러나 원하는 경우 manpath가 다른 파일을 읽도록 강제할 수 있습니다. 이것은 -C 명령줄 옵션을 사용하여 수행할 수 있습니다.

manpath -C NEWFILE-PATH

결론

Linux 명령줄 작업에 man 페이지 처리가 포함된 경우 manpath 명령이 유용한 도구입니다. 이 튜토리얼에서는 대부분의 manpath 명령줄 옵션에 대해 설명했습니다. 도구에 대한 자세한 내용은 매뉴얼 페이지를 참조하십시오.