쉘내부명령어의 자세한 도움말을 확인하는 help 활용
작성자 정보
- 관리자 작성
- 작성일
컨텐츠 정보
- 2,198 조회
- 0 추천
- 목록
본문
쉘내부명령어의 자세한 도움말을 확인하는 help 활용
help는 리눅스쉘에 들어있는 내부명령어의 자세한 도움말을 표시해주는 쉘내부명령어(builtin commands)입니다.
명령어의 도움말을 볼 수 있는 대표적인 명령어로 help, man, info등이 있습니다.
여기서 man과 info는 주로 외부명령어의 도움말을 확인할 때 사용하는 명령어이며 help는 쉘(SHELL)내부명령어의 도움말을 확인할 때 주로 사용하는 명령어입니다.
사용형식 : help [-s] [pattern]
먼저, help라는 명령어에 대하여 배우기전에 도대체 “쉘내부명령어(builtin commands)”들의 종류에는 어떤 것들이 있는가에 대해서 알아 보도록 합시다.
참고로 이 책의 /bin/bash”편을 보면 쉘내부명령어에 대하여 속 시원하게 알 수 있을 것입니다.
따라서 이번 장에서 우리가 배우고자 하는 것이 쉘내부명령어의 도움말을 볼 수 있는 help라는 명령어의 사용법이기에 먼저 쉘내부명령어에는 어떤 것들이 있는가를 살짝 살펴보고 help명령어의 사용법을 배우도록 하겠습니다.
간단히 “man help”를 실행해 보면 리눅스의 모든 쉘내부명령어들에 대한 매뉴얼을 볼 수 있습니다.
이 중에 가장 윗부분에 출력되는 것은 다음과 같습니다.
[root@su250 ~]# man help BASH_BUILTINS(1) BASH_BUILTINS(1)
NAME bash, :, ., [, alias, bg, bind, break, builtin, cd, command, compgen, complete, con- tinue, declare, dirs, disown, echo, enable, eval, exec, exit, export, fc, fg, getopts, hash, help, history, jobs, kill, let, local, logout, popd, printf, pushd, pwd, read, readonly, return, set, shift, shopt, source, suspend, test, times, trap, type, typeset, ulimit, umask, unalias, unset, wait - bash built-in commands, see bash(1) |
즉, 위의 결과를 보면 bash라는 쉘에 내장되어 있는 내부명령어들의 리스트를 볼 수 있습니다.
예를 들어 bg, bind, break, builtin, cd, command등이 있습니다.
그렇다면 우리는 이번 장에서 배우고자 하는 help라는 명령어의 역할이 “아하! 이런 쉘내부명령어들의 도움말을 개별적으로 확인할 수 있는 명령어가 바로 help명령어 이구나.”라는 것을 알 수 있습니다.
자, 이제 이런 쉘내부명령어들의 도움말을 보도록 하겠습니다.
즉, 여러분이 알고자 하는 특정 쉘내부명령어의 자세한 도움말을 확인하시려면 “help 내부명령어”라고 하시면 됩니다.
다음 예는 help라는 내부명령어의 자세한 도움말을 확인한 것입니다.
[root@su250 ~]# help help help: help [-s] [pattern ...] Display helpful information about builtin commands. If PATTERN is specified, gives detailed help on all commands matching PATTERN, otherwise a list of the builtins is printed. The -s option restricts the output for each builtin command matching PATTERN to a short usage synopsis. [root@su250 ~]# |
그리고 다음 예는 umask라는 내부명령어의 자세한 도움말을 확인한 것입니다.
[root@su250 ~]# help umask umask: umask [-p] [-S] [mode] The user file-creation mask is set to MODE. If MODE is omitted, or if `-S' is supplied, the current value of the mask is printed. The `-S' option makes the output symbolic; otherwise an octal number is output. If `-p' is supplied, and MODE is omitted, the output is in a form that may be used as input. If MODE begins with a digit, it is interpreted as an octal number, otherwise it is a symbolic mode string like that accepted by chmod(1). [root@su250 ~]# |
그리고 다음은 ulimit이라는 쉘내부명령어의 도움말을 출력 하였습니다.
[root@su250 ~]# help ulimit ulimit: ulimit [-SHacdfilmnpqstuvx] [limit] Ulimit provides control over the resources available to processes started by the shell, on systems that allow such control. If an option is given, it is interpreted as follows: -S use the `soft' resource limit -H use the `hard' resource limit -a all current limits are reported -c the maximum size of core files created -d the maximum size of a process's data segment -e the maximum scheduling priority (`nice') -f the maximum size of files written by the shell and its children -i the maximum number of pending signals -l the maximum size a process may lock into memory -m the maximum resident set size (has no effect on Linux) -n the maximum number of open file descriptors -p the pipe buffer size -q the maximum number of bytes in POSIX message queues -r the maximum real-time scheduling priority -s the maximum stack size -t the maximum amount of cpu time in seconds -u the maximum number of user processes -v the size of virtual memory -x the maximum number of file locks If LIMIT is given, it is the new value of the specified resource; the special LIMIT values `soft', `hard', and `unlimited' stand for the current soft limit, the current hard limit, and no limit, respectively. Otherwise, the current value of the specified resource is printed. If no option is given, then -f is assumed. Values are in 1024-byte increments, except for -t, which is in seconds, -p, which is in increments of 512 bytes, and -u, which is an unscaled number of processes. [root@su250 ~]# |
그리고 다음과 같이 2개 이상의 내부명령어의 도움말을 동시에 확인할 수도 있습니다.
즉, 다음 예는 kill 내부명령어와 source라는 내부명령어의 도움말을 동시에 확인한 예입니다.
[root@su250 ~]# help kill source kill: kill [-s sigspec|-n signum | -sigspec] pid | jobspec ... or kill -l [sigspec] Send the processes named by PID (or JOBSPEC) the signal SIGSPEC. If SIGSPEC is not present, then SIGTERM is assumed. An argument of `-l' lists the signal names; if arguments follow `-l' they are assumed to be signal numbers for which names should be listed. Kill is a shell builtin for two reasons: it allows job IDs to be used instead of process IDs, and, if you have reached the limit on processes that you can create, you don't have to start a process to kill another one. source: source filename [arguments] Read and execute commands from FILENAME and return. The pathnames in $PATH are used to find the directory containing FILENAME. If any ARGUMENTS are supplied, they become the positional parameters when FILENAME is executed. [root@su250 ~]# |
그리고 만약 아래와 같이 내부명령어가 아닌 외부명령어를 help로 확인하려고 하면 아래와 같이 man이나 info라는 명령어로 확인하라는 메시지만을 보여주게 됩니다.
아래의 예는 find라는 외부명령어의 도움말을 help명령어로 확인하려고 한 예입니다.
[root@su250 ~]# ls -l /bin/find -rwxr-xr-x 1 root root 161192 Apr 30 2008 /bin/find [root@su250 ~]# [root@su250 ~]# help find -bash: help: no help topics match `find'. Try `help help' or `man -k find' or `info find'. [root@su250 ~]# |
이런 외부명령어들을 help명령어로 도움말을 확인하려고 하면 위의 예와 같이 “도움말이 존재하지 않는다”라고 나옵니다.
관련자료
-
이전
-
다음