linux type命令(用来显示指定命令的类型,判断给出的指令是内部指令还是外部指令,如果给出的指令为外部指令,则显示其绝对路径)
生活随笔
收集整理的這篇文章主要介紹了
linux type命令(用来显示指定命令的类型,判断给出的指令是内部指令还是外部指令,如果给出的指令为外部指令,则显示其绝对路径)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
文章目錄
- type
- 補充說明
- 語法
- 選項
- 參數
- 實例
type
顯示指定命令的類型
補充說明
type命令 用來顯示指定命令的類型,判斷給出的指令是內部指令還是外部指令。
命令類型:
- alias:別名。
- keyword:關鍵字,Shell保留字。
- function:函數,Shell函數。
- builtin:內建命令,Shell內建命令。
- file:文件,磁盤文件,外部命令。
- unfound:沒有找到。
語法
type(選項)(參數)選項
- -t:輸出“file”、“alias”或者“builtin”,分別表示給定的指令為“外部指令”、“命令別名”或者“內部指令”;
- -p:如果給出的指令為外部指令,則顯示其絕對路徑;
- -a:在環境變量“PATH”指定的路徑中,顯示給定指令的信息,包括命令別名。
參數
指令:要顯示類型的指令。
實例
[root@localhost ~]# type ls ls is aliased to `ls --color=tty' [root@localhost ~]# type cd cd is a shell builtin [root@localhost ~]# type date date is /bin/date [root@localhost ~]# type mysql mysql is /usr/bin/mysql [root@localhost ~]# type nginx -bash: type: nginx: not found [root@localhost ~]# type if if is a shell keyword [root@localhost ~]# type which which is aliased to `alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde' [root@localhost ~]# type -a cd cd is a shell builtin [root@localhost ~]# type -a grep grep is /bin/grep參考文章:type
總結
以上是生活随笔為你收集整理的linux type命令(用来显示指定命令的类型,判断给出的指令是内部指令还是外部指令,如果给出的指令为外部指令,则显示其绝对路径)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 正常shell bash脚本文件最后一行
- 下一篇: 对源码包打补丁方法Patch