type
プロセスとシステム
書き方
type [-a] <name>ある名前が実際に何なのか — 別名か、関数か、組み込みか、ファイルか — をシェル自身に尋ねます。PATH しか見ない `which` が取りこぼすものが分かります。
よく使うオプション
| オプション | 意味 |
|---|---|
| -a | Every meaning of the name, in the order the shell would consider them. |
| -t | One word only: alias, keyword, function, builtin or file. |
| -P | Force a PATH lookup even if the name is also an alias or function (bash). |
| -f | Ignore shell functions. |
例
type -a lsReveals the alias first and the /bin/ls binary second.
type -t rmPrints "file" if nothing is shadowing it, "alias" if something is.
何が動いていて何が資源を食っているかを見ます。止める前に何なのかを確かめるのが順番です。
読み方
- 角括弧 [ ] は省いてよい部分です。
- 三点 … は複数並べられるという意味です。
- オプションは大文字小文字を区別します — -r と -R が別物のコマンドもあります。
よくある質問
Q. type は何をしますか。
ある名前が実際に何なのか — 別名か、関数か、組み込みか、ファイルか — をシェル自身に尋ねます。PATH しか見ない `which` が取りこぼすものが分かります。
Q. どう打ちますか。
type [-a] <name> — 角括弧は省いてよい部分です。
Q. よく使うオプションはいくつですか。
ここにまとめたのは4個です。全部は man type にあります。このコマンドはプロセスとシステムの仲間です。
関連するコマンド
man ページ: man type