zoukankan      html  css  js  c++  java
  • Linux type命令的用法

     一般情况下,type命令被用于判断另外一个命令是否是内置命令,但是它实际上有更多的用法。

          1.判断一个名字当前是否是alias、keyword、function、builtin、file或者什么都不是:

                type ls 的输出是 ls 是 `ls --color=auto' 的别名

                type if 的输出是 if 是 shell 关键字

                type type 的输出是 type 是 shell 内嵌

                type frydsh 的输出是 bash: type: frydsh: 未找到

          2.判断一个名字当前是否是alias、keyword、function、builtin、file或者什么都不是的另一种方法(适用于脚本编程):

                type -t ls 的输出是 alias

                type -t if 的输出是 keyword

                type -t type 的输出是 builtin

                type -t gedit 的输出是 file

                type -t frydsh 没有输出

          3.显示一个名字的所有可能:

                type -a kill 的输出是 kill 是 shell 内嵌 和 kill 是 /bin/kill

                type -at kill 的输出是 builtin 和 file

          4.查看一个命令的执行路径(如果它是外部命令的话):

                type -p gedit 的输出是 /usr/bin/gedit

                type -p kill 没有输出(因为kill是内置命令)

          5.强制搜索外部命令:

                type -P kill 的输出是 /bin/kill

  • 相关阅读:
    springboot + mybatis + 多数据源
    Git 常见问题汇总
    Git 常见问题汇总
    sqlserver存储过程实现多表分页
    bzoj5248(洛谷4363)(2018九省联考)一双木棋
    bzoj4033 [HAOI2015]树上染色
    bzoj3195 [Jxoi2012]奇怪的道路
    bzoj1426(洛谷4550)收集邮票
    bzoj4806 炮
    bzoj1090(SCOI2003)字符串折叠
  • 原文地址:https://www.cnblogs.com/jxhd1/p/6699177.html
Copyright © 2011-2022 走看看