linux之type命令

显示指定命令的类型。

命令语法

type [-afptP] name [name ...]

命令作用

命令选项

命令参数

命令返回值

当指定的命令可以找到时返回成功,如果有没找到的返回失败。

接下来要用到的例子假设'~/.bashrc'文件定义了以下的内容:

alias ls='ls --color=auto'
test123(){ vim ~/.bashrc; }

而且执行环境里没有使用enable禁用内建命令。
type -a test123

test123 is a function
test123 ()
{
    vim ~/.bashrc
}

type -a -f test123

bash: type: test123: not found

type -a -p test123


type -a ls

ls is aliased to `ls --color=suto'
ls is /usr/bin/ls
ls is /bin/ls

type -a -p ls

/usr/bin/ls
/bin/ls
type -p printf

type -P printf

/usr/bin/printf
/bin/printf
type -t ls

alias

type -t for

keyword

type -t test123

function

type -t -f test123

type -t printf

builtin

type -t chmod

file

注意

  1. 该命令是 bash 内建命令,相关的帮助信息请查看help命令。
  2. 命令优先级问题请查看builtin命令。
展开阅读全文

页面更新:2024-03-14

标签:命令   优先级   别名   语法   单词   路径   函数   环境变量   选项   例子   定义   关键字   类型   文件   科技   信息

1 2 3 4 5

上滑加载更多 ↓
推荐阅读:
友情链接:
更多:

本站资料均由网友自行发布提供,仅用于学习交流。如有版权问题,请与我联系,QQ:4156828  

© CopyRight 2020-2024 All Rights Reserved. Powered By 71396.com 闽ICP备11008920号-4
闽公网安备35020302034903号

Top