コマンドwhereis rmを使用します
$ whereis rm
/bin/rm
次に、which rmを試してみます
$ which rm
/usr/local/opt/coreutils/libexec/gnubin/rm
結果は異なります…つまり、どのrm rm readmeのようなコマンドを実行すると呼び出されます ?
承認された回答:
DenilsonSáMaiaによるスーパーユーザーに関するこの回答は役立つ場合があります:
whichユーザー固有のPATHを検索します(検索する場所の一部が含まれる場合と、他の場所が含まれない場合があります。whereisが含まれる場合もあります。 PATHに追加した場合は検索されません)。
whereis標準の*nixの場所で、指定されたコマンドを検索します。$ whatis which which (1) - shows the full path of (shell) commands $ whatis whereis whereis (1) - locate the binary, source, and manual page files for a command基本的に、
whereiswhichを実行しながら、「おそらく有用な」ファイルを検索します 実行可能ファイルのみを検索します。
whereisを使用することはめったにありません 。一方、which特にスクリプトで非常に便利です。which次の質問に対する答えは次のとおりです。このコマンドはどこから来たのですか?$ which ls /bin/ls $ whereis ls ls: /bin/ls /usr/share/man/man1p/ls.1p.bz2 /usr/share/man/man1/ls.1.bz2