next up previous
: pushd コマンド, popd コマンド : コマンド : which コマンド

type コマンド

which コマンドでは,コマンドの場所が表示されない場合がある. これは,別のコマンドを駆使して新たなコマンドを作っている場合や, 名前自身を変更した場合 (エイリアス処理(alias)) である.
\begin{itembox}[l]{{\tt which} でわからない場合}
\begin{alltt}
\relax{} prompt% ...
...ll\(\scriptstyle\hookleftarrow\)\hfill\crcr}}
\\ \relax \end{alltt}\end{itembox}

そのようなときは, type コマンドで知ることができる.
\begin{itembox}[l]{{\tt type} コマンド(1)}
\begin{alltt}
\relax{} prompt% \under...
...ll\crcr}}
\\ which is aliased to \lq type -path'
\\ \relax \end{alltt}\end{itembox}
ここでわかることは, ls コマンドは,実は ls -F を処理していることになり, which コマンド自身は, 実は type -path コマンドで処理されていることがわかる.

実際, which と, type -path では同じ処理となる.
\begin{itembox}[l]{{\tt which} コマンドと {\tt type} コマンド}
\begin{alltt}
\re...
...ll\(\scriptstyle\hookleftarrow\)\hfill\crcr}}
\\ \relax \end{alltt}\end{itembox}

type -type によりコマンドの種類を調べることができる.
\begin{itembox}[l]{{\tt type -type} コマンド}
\begin{alltt}
\relax{} prompt% \un...
...ptstyle\hookleftarrow\)\hfill\crcr}}
\\ alias
\\ \relax \end{alltt}\end{itembox}

この他, type コマンドは以下のオプションを使うことができる.

type 別名(alias) を調べる.
type -path コマンドの場所を調べる. which コマンド.
type -type コマンドの種類を調べる.別名(alias),ファイル(file) など
type -all 全ての情報を表示する.
type -help ヘルプを表示する.

type -all コマンドにより,上の情報を一度に表示することができる.



Yasushi KODAMA 平成12年6月4日