zoukankan      html  css  js  c++  java
  • <linux下内置命令和外部命令>

    Linux下内置命令和外部命令

    1、linux的命令可以分为内部命令和外部命令:

    内部命令在系统启动时就调入内存,是常驻内存的,所以执行效率高。

    而外部命令是系统的软件功能,用户需要时才从硬盘中读入内存。

    enable既可以查看内部命令,同时也可以判断是否为内部命令。

    [root@localhost ~]# enable ls    //判断ls是否为内置命令
    -bash: enable: ls: not a shell builtin   //它不是内部命令
    [root@localhost ~]# enable pwd   //pwd为内部命令
    [root@localhost ~]# enable -n   //关闭使用pwd内部命令 -n

    [root@localhost ~]# enable -a| grep  pwd    //查看是否关闭
    enable -n pwd
    [root@localhost ~]# enable pwd    //开启使用pwd内置命令
    [root@localhost ~]# enable -a| grep  pwd
    enable pwd

    内部命令用户输入时系统调用的速率快,不是内置命令,系统将会读取环境变量文件.bash_profile、/etc/profile去找PATH路径。

    然后在提一下命令的调用,有些历史命令使用过后,会存在在hash表中,当你再次输入该命令它的调用会是这样一个过程。

    hash——>内置命令——>PATH   命令的调用其实应该是这样一个过程。

    [root@localhost ~]# pwd            
    /root
    [root@localhost ~]# ls
    anaconda-ks.cfg  install.log  install.log.syslog
    [root@localhost ~]# hash -l  //显示hash表
    builtin hash -p /bin/cat cat
    builtin hash -p /bin/ls ls

    从hash表中可以看出。hash表不存放系统内置命令。

  • 相关阅读:
    webstorm之js,css文件压缩
    Dojo的UI框架bootstrap for dojo和Dojo-Bootstrap简介
    android 之 java环境部署
    利用requestjs优化响应式移动端js加载
    前端自动化部署之gulp
    ubuntu配置LAMP
    html5的116个标签
    前端环境安装(node.js+npm+grunt+bower)
    git在webstorm中的使用
    JDK下载安装与环境变量path配置
  • 原文地址:https://www.cnblogs.com/linux-super-meng/p/4155000.html
Copyright © 2011-2022 走看看