当前位置:   article > 正文

Linux常用命令——type命令_linux命令-type

linux命令-type

在线Linux命令查询工具(http://www.lzltool.com/LinuxCommand)

type

显示指定命令的类型

补充说明

type命令用来显示指定命令的类型,判断给出的指令是内部指令还是外部指令。
命令类型:

  • alias:别名。
  • keyword:关键字,Shell保留字。
  • function:函数,Shell函数。
  • builtin:内建命令,Shell内建命令。
  • file:文件,磁盘文件,外部命令。
  • unfound:没有找到。

语法

type(选项)(参数)
  • 1

选项

-t:输出“file”、“alias”或者“builtin”,分别表示给定的指令为“外部指令”、“命令别名”或者“内部指令”;
-p:如果给出的指令为外部指令,则显示其绝对路径;
-a:在环境变量“PATH”指定的路径中,显示给定指令的信息,包括命令别名。
  • 1
  • 2
  • 3

参数

指令:要显示类型的指令。

实例

[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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26

在线Linux命令查询工具(http://www.lzltool.com/LinuxCommand)

在线Linux命令查询工具(http://www.lzltool.com/LinuxCommand)
原文链接

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号