whereis command

請對照下面幾個指令的用法

觀看 help

執行

$ whereis --help

或是執行

$ whereis -h

顯示

Usage:
 whereis [options] [-BMS <dir>... -f] <name>

Locate the binary, source, and manual-page files for a command.

Options:
 -b         search only for binaries
 -B <dirs>  define binaries lookup path
 -m         search only for manuals and infos
 -M <dirs>  define man and info lookup path
 -s         search only for sources
 -S <dirs>  define sources lookup path
 -f         terminate <dirs> argument list
 -u         search for unusual entries
 -l         output effective lookup paths

For more details see whereis(1).

觀看版本

執行

$ whereis -V

顯示

whereis from util-linux 2.27.1

觀看 manpage

執行

$ whatis whereis

或是執行

$ man -k whereis

顯示

whereis (1)          - locate the binary, source, and manual page files for a command

執行

$ man whereis

或是執行

$ man 1 whereis

會看到「說明」。

查詢 whereis 放在那個位置

執行

$ whereis whereis

顯示

whereis: /usr/bin/whereis /usr/share/man/man1/whereis.1.gz

執行

$ which whereis

顯示

/usr/bin/whereis

執行

$ type whereis

顯示

whereis is hashed (/usr/bin/whereis)

查詢 whereis 屬於那個套件

執行

$ dpkg -S /usr/bin/whereis

或是執行

$ dpkg -S $(which whereis)

顯示

util-linux: /usr/bin/whereis

表示「/usr/bin/whereis」是屬於「util-linux」這個套件。

使用範例

執行

$ whereis bash

顯示

bash: /bin/bash /etc/bash.bashrc /usr/share/man/man1/bash.1.gz /usr/share/info/bash.info.gz

執行

$ whereis -b bash

顯示

bash: /bin/bash /etc/bash.bashrc

執行

$ whereis -m bash

顯示

bash: /usr/share/man/man1/bash.1.gz /usr/share/info/bash.info.gz

執行

$ whereis -l

顯示

bin: /usr/bin
bin: /usr/sbin
bin: /usr/lib
bin: /bin
bin: /sbin
bin: /etc
bin: /lib
bin: /lib64
bin: /usr/games
bin: /usr/local/bin
bin: /usr/local/sbin
bin: /usr/local/etc
bin: /usr/local/lib
bin: /usr/local/games
bin: /usr/include
bin: /usr/local
bin: /usr/share
...略...