우리는 bash가 다음과 같은 많은 buitin 명령을 지원 한다는 것을 알고 있습니다 .
$ type type cd help command
type is a shell builtin
cd is a shell builtin
help is a shell builtin
command is a shell builtin
사용 가능한 모든 쉘 내장 명령의 목록 을 얻고 싶습니다 . 명령 줄로 어떻게합니까?
답변
터미널 유형에서 :
help
보낸 사람 help help
:
Display information about builtin commands.
답변
compgen -b
bash 쉘에서 쉘의 내장 명령 목록을 얻을 수 있습니다 .
답변
또는 다음 enable
명령을 사용 하여 표시 할 수 있습니다 (@ karel ‘s 및 @ steeldriver ‘s answer 모두 잘 작동합니다.)
enable -a | cut -d " " -f 2,3
내장 기능이 비활성화되어 있으면 내장 -n
출력으로 표시됩니다 .
출력 예 :
$ enable -a | cut -d " " -f 2,3
.
:
[
alias
bg
bind
break
builtin
caller
cd
command
compgen
complete
compopt
continue
declare
dirs
disown
echo
enable
eval
exec
exit
export
false
fc
fg
getopts
hash
help
history
jobs
kill
let
local
logout
mapfile
popd
printf
pushd
pwd
read
readarray
readonly
return
set
shift
shopt
source
suspend
test
times
trap
true
type
typeset
ulimit
umask
unalias
unset
wait
답변
단순히 데이터 포맷 / 추출을 위해 외부 바이너리를 포크하는 것을 싫어하는 사람들을 위해 :
while read -r _ cmd ; do echo $cmd ; done < <(enable -a)
답변
터미널에 입력하십시오 :
man bash
bash 매뉴얼이 열립니다. 아래로 스크롤하면 SHELL BUILTIN COMMANDS를 찾을 수 있습니다. 여기에서 모든 내장 명령과 그 기능에 대해 알 수 있습니다. txt 형식의 매뉴얼을 원하면이 명령을 사용하십시오.
man bash > FILENAME.txt
이제 bash manual의 텍스트 파일이 있습니다.
답변
또 다른 방법: man builtins
내장 목록을 맨 위에 표시 한 다음 아래 각 명령에 대한 모든 세부 정보를 갖습니다.
SYNOPSIS
bash defines the following built-in commands: :, ., [, alias, bg, bind,
break, builtin, case, cd, command, compgen, complete, continue,
declare, dirs, disown, echo, enable, eval, exec, exit, export, fc, fg,
getopts, hash, help, history, if, 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, until, wait, while.