2022
我们一起努力

有哪些Linux系统命令 - 系统运维

本篇内容介绍了“有哪些Linux系统命令”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

  Linux的命令分为内部命令和外部命令:

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

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

  type可以用来判断一个命令是否为内置命令

  type: usage: type [-afptP] name [name 。。。]

  [root@linuxeye ~]# type type

  type is a shell builtin

  [root@linuxeye ~]# type -p type

  [root@linuxeye ~]# type -t type

  builtin

  [root@linuxeye ~]# type type

  type is a shell builtin

  [root@linuxeye ~]# type -t type

  builtin

  [root@linuxeye ~]# type pwd

  pwd is a shell builtin

  [root@linuxeye ~]# type whiptail

  whiptail is /usr/bin/whiptail

  [root@linuxeye ~]# type -t whiptail

  file

  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 pwd

  pwd is a shell builtin

  [root@linuxeye ~]# type cat

  cat is /usr/bin/cat

  [root@linuxeye ~]# ls linuxeye*

  linuxeye.pem linuxeye.txt

  [root@linuxeye ~]# cat linuxeye.txt

  linuxeye

  [root@linuxeye ~]# hash -l #显示hash表

  builtin hash -p /usr/bin/cat cat

  builtin hash -p /usr/bin/ls ls

  [root@linuxeye ~]# type cat

  cat is hashed (/usr/bin/cat)

  [root@linuxeye ~]# hash -r #清除hash表

  [root@linuxeye ~]# type cat

  cat is /usr/bin/cat

  从上面操作可以看出。hash表不存放系统内置命令。

“有哪些Linux系统命令”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注云网站,小编将为大家输出更多高质量的实用文章!

赞(0)
文章名称:《有哪些Linux系统命令 - 系统运维》
文章链接:https://www.fzvps.com/25691.html
本站文章来源于互联网,如有侵权,请联系管理删除,本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。
图片版权归属各自创作者所有,图片水印出于防止被无耻之徒盗取劳动成果的目的。

评论 抢沙发

评论前必须登录!