查找程序文件
1)检查命令mkdir的程序文件在哪里
2)检查命令ls的程序文件在哪里
3)检查命令ifconfig的程序文件在哪里
4)检查命令hostname的程序文件在哪里
利用which命令可以查找命令的程序文件在哪里,一般适用于外部命令。
利用echo命令可以输出PATH变量的值,但需注意要在变量前加上“$”符号。
步骤一:检查命令mkdir的程序文件在哪里
[root@localhost /]# which mkdir
/bin/mkdir
[root@localhost /]#
步骤二:检查命令ls的程序文件在哪里
[root@localhost /]# which ls
alias ls='ls --color=auto'
/bin/ls
[root@localhost /]#
步骤三:检查命令ifconfig的程序文件在哪里
[root@localhost /]# which ifconfig
/sbin/ifconfig
[root@localhost /]#
步骤四:检查命令hostname的程序文件在哪里
[root@localhost /]# which hostname
/bin/hostname
[root@localhost /]#
步骤五:尝试查找cd的程序文件在哪里
[root@localhost /]# which cd //因为cd为内部命令没有具体的路径
/usr/bin/which: no cd in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
[root@localhost /]#