본문 바로가기
SWE/Linux

리눅스 man 숫자 의미는? | man 사용법 고급 수준

by S나라라2 2023. 2. 14.
반응형

 

리눅스 터미널 창에서 'man [명령어]'를 사용하면 도움말을 볼 수 있다.

$ man mkdir

 

도움말을 보면 명령어 옆 괄호 숫자가 있는 것을 볼 수 있다.

매뉴얼 명령어(숫자)의 의미는?

섹션을 의미한다

 

- 1섹션: 쉘 명령어

ex) mkdir, ls, dir, mv, ...

- 2섹션: 시스템 호출 (커널을 직접 제어하는 함수)

ex) socket, open, close, fcntl, ...

- 3섹션: 라이브러리 함수

ex) queue, qsort, htonl, bzero, ...

 


 

 

특정 섹션의 매뉴얼을 보고 싶은 경우

명령어가 세션 두 개 이상에 중복으로 위치할 경우 작은 숫자의 매뉴얼을 우선적으로 보여준다.

예를 들면 uname은 세션 1에도 위치하고 섹션 2에도 위치하지만, $man uname 명령어를 입력할 경우 섹션 1의 내용을 보여준다.

$ man uname

uname: os 정보 보는 명령어

다른 섹션의 매뉴얼을 보고 싶은 경우 s옵션을 사용한다.

$ man -s 2 uname

섹션2에 위치한 uname 매뉴얼을 확인할 수 있다.

 


 

Man 명령어 정규식으로 검색하는 방법

 

명령어 기억이 가물가물할 때가 있다. 그럴 때 k 옵션을 사용하면 유용하다.

- 예시 1

$ man -k dir
addgnupghome (8)     - Create .gnupg home directories
alphasort (3)        - scan a directory for matching entries
basename (1)         - strip directory and suffix from filenames
bdflush (2)          - start, flush, or tune buffer-dirty-flush daemon
bindtextdomain (3)   - set directory containing message catalogs
chacl (1)            - change the access control list of a file or directory
chdir (2)            - change working directory
chroot (2)           - change root directory
chroot (8)           - run command or interactive shell with special root directory
closedir (3)         - close a directory
cp (1)               - copy files and directories
cups-files.conf (5)  - file and directory configuration file for cups
dbus-cleanup-sockets (1) - clean up leftover sockets in a directory
depmod.d (5)         - Configuration directory for depmod
dh_bugfiles (1)      - install bug reporting customization files into package build directories
dh_clean (1)         - clean up package build directories
dh_compress (1)      - compress files and fix symlinks in package build directories
dh_fixperms (1)      - fix permissions of files in package build directories
...

 

명령어와 설명에 dir이 들어간 리스트를 모두 보여준다. (dir과 관련된 명령어 모음)

 

- 예시 2

$ man -k ^mk
mk_modmap (8)        - translate a Linux keytable file into an xmodmap file
mkdir (1)            - make directories
mkdir (2)            - create a directory
mkdirat (2)          - create a directory
mkdosfs (8)          - create an MS-DOS filesystem under Linux
mkdtemp (3)          - create a unique temporary directory
mke2fs (8)           - create an ext2/ext3/ext4 filesystem
mke2fs.conf (5)      - Configuration file for mke2fs
mkfifo (1)           - make FIFOs (named pipes)
mkfifo (3)           - make a FIFO special file (a named pipe)
mkfifoat (3)         - make a FIFO special file (a named pipe)
mkfontdir (1)        - create an index of X font files in a directory
mkfontscale (1)      - create an index of scalable font files for X
...

mk로 시작하는 명령어 검색한 결과이다. (정규식에서 ^기호는 시작 문구 지정이다)

 

 


명령어 섹션 확인 방법

명령어가 어떤 섹션에 포함되는지 알고 싶을 때는 -f 옵션을 사용하면 된다.

$ man -f uname
uname (1)            - print system information
uname (2)            - get name and information about current kernel

output의 괄호 안 숫자를 보면 섹션을 확인할 수 있다. uname은 섹션1, 섹션2에 위치하고 있다.

 

 

 

반응형