内部命令:也称shell内嵌命令;
外部命令:存放在一个文件中,使用时需要去文件中查找,这些文件被定义在$PATH
[iyunv@centos7 ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
type命令可以查看命令类型,以区别是内部命令还是外部命令
例
[iyunv@centos7 ~]# type cd
cd is a shell builtin
[iyunv@centos7 ~]# type ls
ls is aliased to `ls --color=auto'
[iyunv@centos7 ~]# type ifconfig
ifconfig is /usr/sbin/ifconfig
可以看到,cd为shell内嵌命令,ls命令为ls --color=auto的别名,ifconfig命令为外部命令在文件/usr/sbin/ifconfig中。
内部命令与外部命令查看帮助的区别
内部命令:
使用help COMMAND
[iyunv@centos7 ~]# help cd
cd: cd [-L|[-P [-e]]] [dir]
Change the shell working directory.
......
也可使用man命令查看bash帮助文档
enable命令可以禁用内部命令;
enable -n 内部命令: 禁用内部命令(重启失效)
:enable -n cd
enable 内部命令:解除禁用
:enable cd
外部命令:
外部命令查看帮助的方法相对与内部命令还是比较多的
① command --help 或 command -h
命令的不同存在一些实用长选项 --help或短选项 -h的区别
例:[iyunv@centos7 ~]# ifconfig --help
Usage:
ifconfig [-a] [-v] [-s] <interface> [[<AF>] <address>]
[add <address>[/<prefixlen>]]
......
②使用man手册查看帮助, man command
例:[iyunv@centos7 ~]# man ifconfig
IFCONFIG(8) Linux System Administrator's Manual IFCONFIG(8)
NAME
ifconfig - configure a network interface
......
③使用info命令查看信息页
例:[iyunv@centos7 ~]# info ifconfig
File: *manpages*, Node: ifconfig, Up: (dir)
IFCONFIG(8) Linux System Administrator's Manual IFCONFIG(8)