Bash는 Batch와 동일합니까?

Bash는 Batch와 동일합니까?

Windows에서 "tasklist"를 실행하면 명령 프롬프트가 프로세스 목록을 반환합니다. 내장 함수라고 생각했지만 System32 디렉터리의 실행 파일일 뿐입니다. 이제 Linux의 'ps' 명령이 실행 파일인지 아니면 Bash 터미널 자체의 내장 명령인지 묻고 싶습니다.

또 다른 질문: SSH는 단지 Bash 터미널인가요?(물론 인터넷과 같은 일부 고급 기능도 포함되어 있습니다)

답변1

모든 내장 명령을 나열하려면 다음을 수행하십시오.

compgen -b

단일 명령에 대한 정보를 얻으려면 typecommand를 사용할 수 있습니다. 예:

type -a cd
cd is a shell builtin

또는 (확인해 보세요):

compgen -b | grep cd
cd

예 2:

compgen -b | grep ssh

아무것도 반환하지 않습니다. ssh는 외부 명령입니다.

추가 정보 :

답변2

첫 번째 부분에 답변하겠습니다. 먼저 쉘 내장:

$ help command
command: command [-pVv] command [arg ...]
    Execute a simple command or display information about commands.

    Runs COMMAND with ARGS suppressing  shell function lookup, or display
    information about the specified COMMANDs.  Can be used to invoke commands
    on disk when a function with the same name exists.

    Options:
      -p    use a default value for PATH that is guaranteed to find all of
            the standard utilities
      -v    print a description of COMMAND similar to the `type' builtin
      -V    print a more verbose description of each COMMAND

    Exit Status:
    Returns exit status of COMMAND, or failure if COMMAND is not found.

다음으로 command내장 기능 을 사용하여 ps.

$ command -V ps
ps is hashed (/bin/ps)

따라서 ps자체 바이너리입니다.

답변3

음, ps독립 실행형 바이너리입니다. 'cmd'에 대해 이를 찾아보거나 찾아 which cmd보세요 . whereis cmdWindows용 unix/linux 명령에 대한 .exe 포트도 찾을 수 있습니다.

SSH는 사용자와 원격 시스템 간의 텍스트 기반 통신 채널(가상 터미널)을 엽니다. 'bash'는 가장 많이 사용되는 쉘 중 하나이지만 tcsh, csh, 등 의 다른 쉘도 있습니다. ksh간단히 말해서 SSH는 단순한 bash 터미널이 아닙니다.

관련 정보