Linux 内建命令 VS 外键命令

Linux 内建命令 VS 外键命令

对比:

项目内建命令外键命令
概念shell的一部分(由shell识别并执行)命令实体通常不包含在shell中(执行由shell执行)
加载随系统加载不随系统加载(需要时候加载到内存)
帮助查看方法【补充(2)】help 命令命令 --help
执行【补充(3)】不会产生新的进程会产生命令对应的进程

补充:

(1)查看内部命令还是外部命令,使用内建的type command
[root@localhost tmp]# type pwd
pwd is a shell builtin     (--builtin是内建命令--)
[root@localhost tmp]# type vi
vi is /usr/bin/vi           (--外部命令,显示了外部命令所在的位置--)
(2)查看命令的帮助:

help 内建命令: 启动的是help命令(也是一个内建命令),传入要查看的命令名称
外部命令 --help:启动的是外部命令,传入参数help,得到该命令的参考信息

[root@localhost tmp]# help pwd    (--启动help命令,查看内建命令的帮助信息--)
pwd: pwd [-LP]
    Print the name of the current working directory.
    Options:
      -L        print the value of $PWD if it names the current working (略)
      
[root@localhost tmp]# vi --help   (--启动外部vi命令,查看其帮助信息--)
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Apr 10 2018 23:54:54)
usage: vim [arguments] [file ..]       edit specified file(s)
   or: vim [arguments] -               read text from stdin
   or: vim [arguments] -t tag          edit file where tag is defined
Arguments: (略)
(3)执行命令时候的进程:

外部命令以vi为例:
执行 vi /tmp/1.sh前后的进程情况,执行vi后,出现了vi的进程

[root@localhost ~]# ps -ef|grep vi    (--执行vi命令前--)
root     12129 12102  0 17:33 pts/1    00:00:00 grep --color=auto vi

另一个shell窗口查看

 [root@localhost ~]# ps -ef|grep vi   (--使用另外一个窗口,执行vi命令后--)
root     12130  1692  0 17:33 pts/0    00:00:00 vi 1.sh  (--vi的进程--)
root     12132 12102  0 17:33 pts/1    00:00:00 grep --color=auto vi
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值