赞
踩
用途说明
type命令用来显示指定命令的类型。一个命令的类型可以是如下几种:
alias 别名
keyword 关键字,Shell保留字
function 函数,Shell函数
builtin 内建命令,Shell内建命令
file 文件,磁盘文件,外部命令
unfound 没有找到
它是Linux系统的一种自省机制,知道了是哪种类型,我们就可以针对性的获取帮助。比如:
内建命令可以用help命令来获取帮助,外部命令用man或者info来获取帮助。
常用参数
type命令的基本使用方式就是直接跟上命令名字。
type -a可以显示所有可能的类型,比如有些命令如pwd是shell内建命令,也可以是外部命令。
type -p只返回外部命令的信息,相当于which命令。
type -f只返回shell函数的信息。
type -t 只返回指定类型的信息。
举个栗子
常用参数举例:
01
#1. 显示所有可能的类型
02
bixiaopeng@bixiaopengtekiMacBook-Pro ~$type -atime
03
time is a shell keyword
04
time is/usr/bin/time
05
#2. 返回外部命令的信息,相当于which
06
bixiaopeng@bixiaopengtekiMacBook-Pro ~$type -ptime
07
#3. 只返回shell函数信息
08
bixiaopeng@bixiaopengtekiMacBook-Pro ~$type -ftime
09
time is a shell keyword
10
#4. 只返回指定的类型
11
bixiaopeng@bixiaopengtekiMacBook-Pro ~$type -ttime
12
keyword
备注:
上面time命令的类型有两个,一个是shell保留字,一个是外部命令,那我们查看帮助的方式可以是
01
bixiaopeng@bixiaopengtekiMacBook-Pro androidshell$man time
02
03
NAME
04
time --time command execution
05
06
SYNOPSIS
07
time [-lp] utility
08
09
DESCRIPTION
10
Thetime utility executes andtimes utility. After the utility finishes,
11
time writes the totaltime elapsed, thetime consumed by system overhead,
12
and thetime used to execute utility to the standard error stream. Times
13
are reportedin seconds.
14
15
Available options:
16
17
18
ile: *manpages*, Node:time, Up: (dir)
19
20
21
bixiaopeng@bixiaopengtekiMacBook-Pro androidshell$ infotime
22
23
TIME(1) BSD General Commands Manual TIME(1)
24
25
NAME
26
time --time command execution
27
28
SYNOPSIS
29
time [-lp] utility
30
31
DESCRIPTION
32
Thetime utility executes andtimes utility. After the utility finishes,
33
time writes the totaltime elapsed, thetime consumed by system overhead,
34
and thetime used to execute utility to the standard error stream. Times
35
-----Info:(*manpages*)time,53 行 --Top-------------------------------------
36
欢迎使用 Info 4.8 版。输入 ? 以获得帮助,m 将得到菜单。
常用命令举例:
01
bixiaopeng@bixiaopengtekiMacBook-Pro ~$type -als
02
ls is/bin/ls
03
bixiaopeng@bixiaopengtekiMacBook-Pro ~$type -awho
04
who is/usr/bin/who
05
bixiaopeng@bixiaopengtekiMacBook-Pro ~$type -acd
06
cd is a shellbuiltin
07
cd is/usr/bin/cd
08
bixiaopeng@bixiaopengtekiMacBook-Pro ~$type -awhich
09
which is/usr/bin/which
10
bixiaopeng@bixiaopengtekiMacBook-Pro ~$type -a mvn
11
mvn is/usr/share/java/maven-3.0.3/bin/mvn
12
mvn is/usr/bin/mvn
13
bixiaopeng@bixiaopengtekiMacBook-Pro ~$type -a adb
14
adb is/Users/bixiaopeng/DevelopSoft/adt-bundle-mac/sdk/platform-tools/adb
15
bixiaopeng@bixiaopengtekiMacBook-Pro ~$type -a aapt
16
aapt is/usr/local/bin/aapt
17
18
bixiaopeng@bixiaopengtekiMacBook-Pro ~$type grep
19
grep is aliased to `grep --color=always'
20
bixiaopeng@bixiaopengtekiMacBook-Pro ~$type awk
21
awk is/usr/bin/awk
linux type命令用法_转
转自:http://codingstandards.iteye.com/blog/831504 在脚本中type可用于检查命令或函数是否存在,存在返回0,表示成功:不存在返回正值,表示不成功. $ t ...
linux type 命令和Linux的五个查找命令
type命令用来显示指定命令的类型.一个命令的类型可以是如下之一 alias 别名 keyword 关键字,Shell保留字 function 函数,Shell函数 builtin 内建命令,Shel ...
Linux type命令的用法
一般情况下,type命令被用于判断另外一个命令是否是内置命令,但是它实际上有更多的用法. 1.判断一个名字当前是否是alias.keyword.function.builtin.file或者什么都不是 ...
[转]Linux之type命令
转自:http://codingstandards.iteye.com/blog/831504 用途说明 type命令用来显示指定命令的类型.一个命令的类型可以是如下之一 alias 别名 keywo ...
linux下的type命令
type命令用来显示指定命令的类型.一个命令的类型可以是如下几种: alias 别名 keyword 关键字,Shell保留字 function 函数,Shell函数 builtin 内建命令,She ...
【转】linux之type命令
转自: http://codingstandards.iteye.com/blog/831504 用途说明 type命令用来显示指定命令的类型.一个命令的类型可以是如下之一 alias 别名 keyw ...
Linux查找命令对比(find、locate、whereis、which、type、grep)
//太长不看版find查找磁盘空间,相较于locate和whereis速度较慢.find和locate的查找单位为文件或者目录,locate其实是find -name的另一种写法.locate和whe ...
Linux常用命令type、date
Linux命令类型: 内置命令(shell内置):cd is shell builtin 外部命令:命令 is /usr/bin/命令,在文件系统的某个路径下有一个与命令名称相应的可执行文件 type ...
Linux下命令行安装weblogic10.3.6
Linux下命令行安装weblogic10.3.6 一.安装前准备工作: 1.创建用户useradd weblogic;创建用户成功linux系统会自动创建一个和用户名相同的分组,并将该用户分到改组中 ...
随机推荐
Easticsearch通信方式_API
目录 返回目录:http://www.cnblogs.com/hanyinglong/p/5464604.html 1.Elasticsearch概念 a. Elasticsearch是一个基于Luc ...
20个优秀的 JavaScript 键盘事件处理库
键盘事件是 Web 开发中最常用的事件之一,通过对键盘事件的捕获和处理可以提高网站的易用性和交互体验.下面,我们向大家介绍收集的20款优秀的 JavaScript 键盘事件处理库,帮助开发人员轻松处理 ...
SwipeBackActivity 的使用
1.SwipeBackLayout 项目地址:https://github.com/ikew0ng/SwipeBackLayout 2.用法 android studio compile 'me.i ...
Effective C++ -----条款17:以独立语句将newed对象置入智能指针
以独立语句将newed对象存储于(置入)智能指针内.如果不这样做,一旦异常被抛出,有可能导致难以察觉的资源泄露.
Symantec更新服务器
HTTP liveupdate.symantec.com liveupdate.symantecliveupdate.com FTP update.symantec.com/opt/content ...
Brute-force Algorithm_矩阵快速幂&;&;欧拉公式*****
Problem Description Professor Brute is not good at algorithm design. Once he was asked to solve a pa ...
ThinkPHP3.2.3中三大自动中的缺陷问题
我们在使用Thinkphp3.2.3框架时在对数据表进行模型化后就可以使用自动完成功能. 自动完成可以帮助我们更简便的完成对表单内容对数据表(集合)的填充,自动完成是基于: 当实例化数据库user后, ...
React组件实现越级传递属性
如果有这样一个结构:三级嵌套,分别是:一级父组件.二级子组件.三级孙子组件,且前者包含后者,结构如图: 如果把一个属性,比如color,从一级传递给三级,一般做法是使用props逐一向下传递,代码如下 ...
C#打印模板设计,E店宝打印模板设置,winfrom打印模板设计,DevExpress.XtraReports.UI.XRTable 表格代码生成。
一.打印效果 二.代码编辑 1 .table1 : table控件的Name: 2.label33 :label控件 实现绑定[外部平台单号]的控件: 3.label32:绑定[E店宝订单编号](S开 ...
poj 2480 Longge's problem 欧拉函数+素数打表
Longge's problem Description Longge is good at mathematics and he likes to think about hard mathem ...
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。