locate
ファイルとディレクトリ
書き方
locate [name]あらかじめ作った索引を引くので即答しますが、最後の updatedb 以降にできたファイルは見えません。
よく使うオプション
| オプション | 意味 |
|---|---|
| -i | Ignore case |
| -l | Stop after N results |
| -c | Print only how many matched |
| -b | GNU mlocate: match the file name, not the whole path |
| -r | GNU: read the pattern as a regular expression |
| -e | GNU: skip entries that no longer exist on disk |
例
locate -i nginx.confFinds the config anywhere on disk, instantly.
sudo updatedbRebuilds the index so new files can be found.
移したり消したり探したりするものです。聞き返してくれない命令が混ざっているので、-i を付ける癖が手を守ります。
読み方
- 角括弧 [ ] は省いてよい部分です。
- 三点 … は複数並べられるという意味です。
- オプションは大文字小文字を区別します — -r と -R が別物のコマンドもあります。
よくある質問
Q. locate は何をしますか。
あらかじめ作った索引を引くので即答しますが、最後の updatedb 以降にできたファイルは見えません。
Q. どう打ちますか。
locate [name] — 角括弧は省いてよい部分です。
Q. よく使うオプションはいくつですか。
ここにまとめたのは6個です。全部は man locate にあります。このコマンドはファイルとディレクトリの仲間です。
関連するコマンド
man ページ: man locate