▼すべてを開く。
▲すべてを閉じる。
$ locate ping | grep -w 'ping' /usr/share/man/man8/ping.8.gz /usr/share/man/ja/man8/ping.8.gz /usr/share/xemacs/xemacs-packages/etc/sounds/the-ping.au /usr/share/xemacs/xemacs-packages/etc/sounds/the-ping.wav /bin/ping
locateコマンドで「ping」を検索し、その結果をパイプ「|」でgrepコマンドに送り、-wオプションと検索文字列「'ping'」を指定する。
grepコマンドのオプション | |
-w | 独立した単語として検索する |
pingコマンドの所在をlocateコマンドで検索すると、「xxxping」や「xxpingxx」など意図しない検索結果が大量に出る。これらの結果の中から単語としての「ping」を検索する時に-wオプションを利用する。
locateコマンドによるpingの検索結果$ locate ping /etc/gnome-vfs-2.0/modules/mapping-modules.conf /usr/share/doc/pspell-0.12.2/man-html/3_Keeping.html /usr/share/doc/pspell-0.12.2/man-text/3_Keeping.txt /usr/share/doc/freetype-2.1.4/docs/glyphs/clipping.png /usr/share/doc/irda-utils-0.9.15/README.irdaping /usr/share/doc/samba-3.0.9/docs/htmldocs/Samba-HOWTO-Collection/groupmapping.html ・・・・・・・・・・・・・・・・・・・・・・・・・・・・中略・・・・・・・・・・・・・・・・・・・・・・・・・・・・ /usr/sbin/arping /usr/sbin/ping6 ・・・・・・・・・・・・・・・・・・・・・・・・・・・・中略・・・・・・・・・・・・・・・・・・・・・・・・・・・・ /bin/ping /bin/ping6 /sbin/arping