标签:pwd 系统文件 EDA hash hits 执行 直接 外部 查看
在shell中可执行命令分为:外部命令:在系统中有对应的可执行文件
通过type可查看命令是否为内部命令
[root@centos1 ~]#type pwd # 内部命令
pwd is a shell builtin
[root@centos1 ~]#type top # 外部命令
top is /usr/bin/top
内部命令直接从内存中读取而外部命令需要从系统文件中读取
[root@centos1 ~]#echo $PATH # 查看外部命令搜索路径
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
[root@centos1 ~]#which top # 查看外部命令可执行文件的路径
/usr/bin/top
[root@centos1 ~]#whereis top # 查看外部命令可执行文件的路径以及帮助文档路径
top: /usr/bin/top /usr/share/man/man1/top.1.gz
[root@centos1 ~]#hash # 为了加快外部命令的执行过程会放入缓存表
hits command
1 /usr/bin/cal
3 /usr/bin/tail
2 /usr/bin/timedatectl
15 /usr/bin/date
1 /usr/bin/cat
5 /usr/bin/whereis
2 /usr/bin/ls
命令执行顺序:内部命令>hash表中的命令>外部命令
标签:pwd 系统文件 EDA hash hits 执行 直接 外部 查看
原文地址:https://blog.51cto.com/14322729/2392937