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


本文摘自PHP中文网,作者巴扎黑,侵删。

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

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

一 whereis

1、语法

whereis 命令名

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

选项:

-b:只查找可执行文件
-m:只查找帮助文件

2、实战


1

2

3

4

5

6

7

8

9

10

11

12

13

[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、实战


1

2

3

4

5

6

7

8

9

[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环境变量

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


1

2

[root@localhost ~]# echo $PATH

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

以上就是Linux命令教程之比较搜索命令whereis与which的区别的详细内容,更多文章请关注木庄网络博客

相关阅读 >>

Linux解决su root切换提示没有文件或目录的图文详解

Linux怎么执行shell脚本

Linux中删除文件的多种方法

Linux下什么是进程

Linux如何查看ftp服务是否开启

Linux查看多少位系统

.Linux中什么意思

关于Linux下如何查看nginx的并发连接数和连接状态的详细介绍

Linux如何查看端口占用情况

Linux下查看cpu使用情况使用什么命令

更多相关阅读请进入《Linux》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...