• type 命令详解


     type 

    作用:
    用来显示指定命令的类型,判断出命令是内部命令还是外部命令。
    命令类型:
    alias: 别名
    keyword:关键字, shell 保留字
    function:函数, shell函数
    builtin: 内置命令,shell内建命令
    file: 文件,磁盘文件,外部命令
    unfound: 没有找到
    语法:
    type (选项)(参数)
    选项:
    -t: 输出file/alias/builtin ,分别表示给定命令为外部命令,命令别名,内部命令
    -p:如果给出的指令为外部命令,则显示绝对路径
    -a:在环境变量PATH指定的路径中,显示给定指令信息,包括命令别名。
    实例:
    type ls : ls is aliased to 'ls --color = tty'
    type cd : cd is a shell builtin
    type date : date is /bin/date
    type mysql: mysql is /usr/bin/mysql
    type nginx:  -bash :type:nginx:notfound
    type if :if is a shell keyword
    type which : which is aliased to 'alias | /usr/bin/which --tty -only --read-alias --show -dot --show-title'
    type -a cd : cd is a shell builtin
    type -t cd : builtin
    type -a grep: grep is /bin/grep

     

  • 相关阅读:
    DevOps平台中的自动化部署
    GitLab的安装及使用教程
    Nginx配置相关
    Shell常用模块
    PostgreSQL基础
    大数据集群监控工具
    大数据常用组件
    kafka知识
    数据结构可视化(包括红黑树动态演示)
    python 周考1
  • 原文地址:https://www.cnblogs.com/LinuxSuDa/p/4372418.html
Copyright © 2020-2023  润新知