whereis php,Linux命令教程之比较搜索命令whereis与which的区别

这篇文章主要介绍了Linux命令搜索命令whereis与which的区别的相关资料,这里举例说明该如何区别他们之家的用法,需要的朋友可以参考下

Linux命令搜索命令whereis与which的区别

一 whereis

1、语法

whereis 命令名

搜索命令所在的路径以及帮助文档所在的位置

选项:

-b:只查找可执行文件

-m:只查找帮助文件

2、实战

[root@localhost ~]# whereis ls

ls:/usr/bin/ls /usr/share/man/man1/ls.1.gz/usr/share/man/man1p/ls.1p.gz

[root@localhost ~]# whoami

root

[root@localhost ~]# whatis

whatis what?

[root@localhost ~]# whatis ls

ls (1)- list directory contents

ls (1p)- list directory contents

[root@localhost ~]# whereis -b ls

ls:/usr/bin/ls

[root@localhost ~]# whereis -m ls

ls:/usr/share/man/man1/ls.1.gz/usr/share/man/man1p/ls.1p.gz

二 which

1、语法

which 命令名

搜索命令所在路径及别名

2、实战

[root@localhost ~]# which ls

alias ls='ls --color=auto'

/usr/bin/ls

[root@localhost ~]# which pwd

/usr/bin/pwd

[root@localhost ~]# whereis cd

cd:/usr/bin/cd /usr/share/man/man1/cd.1.gz/usr/share/man/man1p/cd.1p.gz

[root@localhost ~]# which cd

/usr/bin/cd

三 PATH环境变量

定义的是系统搜索命令的路径

[root@localhost ~]# echo $PATH

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值