
Windows で「tasklist」を実行すると、コマンド プロンプトがプロセスのリストを返します。これは組み込み関数だと思っていましたが、System32 ディレクトリ内の実行可能ファイルでした。Linux の「ps」コマンドも実行可能ファイルなのか、それとも Bash ターミナル自体の組み込みコマンドなのかを知りたいです。
別の質問: SSH は Bash ターミナルだけですか?(もちろん、ネット経由などの高度な機能も備えています)
答え1
すべての組み込みコマンドを一覧表示するには:
compgen -b
単一のコマンドに関する情報を取得するには、type
コマンドを使用できます。例:
type -a cd
cd is a shell builtin
または(チェックしてください):
compgen -b | grep cd
cd
例2:
compgen -b | grep ssh
何も返しません。ssh は外部コマンドです。
詳しくは :
- Bash (Unix シェル)
man bash
ターミナルから入力します(詳細なドキュメント)。
答え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' について調べてみてください。 また、Windows 用の Unix/Linux コマンドの .exe ポートも見つかるwhich cmd
かもwhereis cmd
しれません。
SSH は、ユーザーとリモート マシンの間にテキストベースの通信チャネル (仮想端末) を開きます。「bash」は最もよく使用されるシェルの 1 つですが、、、などのシェルも存在します。つまりtcsh
、簡単に言えば、SSH は単なる bash 端末ではありません。csh
ksh