判断内部命令和外部命令
来源:互联网 发布:sql设置主键语句 编辑:程序博客网 时间:2024/06/07 19:54
内部命令在系统启动时就调入内存,是常驻内存的,所以执行效率高。
- 外部命令是系统的软件功能,用户需要时才从硬盘中读入内存。
type可以用来判断一个命令是否为内置命令
type: usage: type [-afptP] name [name ...]
[root@linuxeye ~]# type typetype is a shell builtin[root@linuxeye ~]# type -p type[root@linuxeye ~]# type -t typebuiltin[root@linuxeye ~]# type typetype is a shell builtin[root@linuxeye ~]# type -t typebuiltin[root@linuxeye ~]# type pwdpwd is a shell builtin[root@linuxeye ~]# type whiptailwhiptail is /usr/bin/whiptail[root@linuxeye ~]# type -t whiptailfile
enable既可以查看内部命令,同时也可以判断是否为内部命令
[root@linuxeye ~]# enable -a #查看内部命令[root@linuxeye ~]# enable whiptail #非内部命令-bash: enable: whiptail: not a shell builtin[root@linuxeye ~]# enable pwd #是内部命令
内部命令用户输入时系统调用的速率快,不是内置命令,系统将会读取环境变量文件.bash_profile、/etc/profile去找PATH路径。
然后在提一下命令的调用,有些历史命令使用过后,会存在在hash表中,当你再次输入该命令它的调用会是这样一个过程。
hash——>内置命令——>PATH 命令的调用其实应该是这样一个过程。
[root@linuxeye ~]# type pwdpwd is a shell builtin[root@linuxeye ~]# type catcat is /usr/bin/cat[root@linuxeye ~]# pwd/root[root@linuxeye ~]# ls linuxeye*linuxeye.pem linuxeye.txt[root@linuxeye ~]# cat linuxeye.txtlinuxeye[root@linuxeye ~]# hash -l #显示hash表builtin hash -p /usr/bin/cat catbuiltin hash -p /usr/bin/ls ls[root@linuxeye ~]# type catcat is hashed (/usr/bin/cat)[root@linuxeye ~]# hash -r #清除hash表[root@linuxeye ~]# type catcat is /usr/bin/cat
从上面操作可以看出。hash表不存放系统内置命令。
阅读全文
0 0
- 判断内部命令和外部命令
- 内部命令和外部命令
- shall 内部命令 和 外部命令
- 3. Redhat内部命令和外部命令
- shell的内部命令和外部命令
- shell内部命令和外部命令
- shell内部命令和外部命令
- shell内部命令和外部命令
- shell的外部命令和内部命令
- Linux中内部命令和外部命令
- Linux中内部命令和外部命令
- DOS内部命令和外部命列表
- 内部命令与外部命令
- 内部命令VS外部命令
- 内部命令VS外部命令
- 内部命令VS外部命令
- .不是内部或外部命令
- telnet不是内部命令或外部命令
- poj3411——Paid Roads
- Ubuntu下的常用命令总结
- 【自然语言处理】情感分析资源
- linux环境下更换JDK
- webRTC入门: 打包webRTC库应用到自己的工程中
- 判断内部命令和外部命令
- Linux ls -l ll ln介绍
- Oracle DBA学习基础篇(一) Oracle体系结构 学习笔记
- js问题
- You need tcl 8.5 or newer in order to run the Redis test
- 解析word文档,获取相应的数据,并封装成相应的javaBean(二)
- 前缀、中缀、后缀表达式
- ASP.NET Core 认证与授权[5]:初识授权
- 欢迎使用CSDN-markdown编辑器