加入收藏 | 设为首页 | 会员中心 | 我要投稿 南平站长网 (https://www.0599zz.com/)- 操作系统、建站、物联安全、数据计算、机器学习!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

type命令用来显示指定命令的类型

发布时间:2023-07-24 10:12:40 所属栏目:Linux 来源:转载
导读:   Linux常用命令type命令用来显示指定命令的类型,判断给出的指令是内部指令还是外部指令,下面为大家分享一下Linux常用命令type命令具体使用方法。



  语法



  type (选
  Linux常用命令type命令用来显示指定命令的类型,判断给出的指令是内部指令还是外部指令,下面为大家分享一下Linux常用命令type命令具体使用方法。
 
  语法
 
  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 cdcd is a shell builtin
 
  [root@localhost ~]# type -a grep
 
  grep is /bin/grep
 

(编辑:南平站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章