網站首頁 美容小常識 享受生活 東方時尚 識真假 高奢 資訊 遊戲攻略 搞笑段子
當前位置:品位站 > 享受生活 > 心理

linux下whereis和which區別

欄目: 心理 / 發佈於: / 人氣:4.74K
linux下whereis和which區別

Linux命令搜索命令whereis與which的區別

一 whereis

1、語法

whereis 命令名

搜索命令所在的路徑以及幫助文檔所在的位置

選項:

-b:只查找可執行文件

-m:只查找幫助文件

2、實戰

[root@localhost ~]# whereis ls

ls:/usr/bin/ls /usr/share/man/man1/

[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/

二 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/

[root@localhost ~]# which cd

/usr/bin/cd

Tags:Linux whereis