[Osaka/Yokohama] Looking for infrastructure/server side engineers!

[Osaka/Yokohama] Looking for infrastructure/server side engineers!

[Deployed by over 500 companies] AWS construction, operation, maintenance, and monitoring services

[Deployed by over 500 companies] AWS construction, operation, maintenance, and monitoring services

[Successor to CentOS] AlmaLinux OS server construction/migration service

[Successor to CentOS] AlmaLinux OS server construction/migration service

[For WordPress only] Cloud server “Web Speed”

[For WordPress only] Cloud server “Web Speed”

[Cheap] Website security automatic diagnosis “Quick Scanner”

[Cheap] Website security automatic diagnosis “Quick Scanner”

[Low cost] Wasabi object storage construction and operation service

[Low cost] Wasabi object storage construction and operation service

[Reservation system development] EDISONE customization development service

[Reservation system development] EDISONE customization development service

[Registration of 100 URLs is 0 yen] Website monitoring service “Appmill”

[Registration of 100 URLs is 0 yen] Website monitoring service “Appmill”

[Compatible with over 200 countries] Global eSIM “beSIM”

[Compatible with over 200 countries] Global eSIM “beSIM”

[Compatible with Chinese corporations] Chinese cloud / server construction, operation and maintenance

[Compatible with Chinese corporations] Chinese cloud / server construction, operation and maintenance

[YouTube] Beyond official channel “Biyomaru Channel”

[YouTube] Beyond official channel “Biyomaru Channel”

Macでlocateコマンドを使用する方法

Mac

普段はMacとWindowsの両刀使い、インフラエンジニアの伊藤です。

Macのファイル検索機能といえばSpotlight検索ですよね!
でも、Spotlight機能だけでは、深い階層にある設定ファイルとかが見つからないんですよね...。

そんなときに使えるのが「locate」コマンドです。ファイルのインデックスデータベースを作成してファイルを高速で検索出来ます。
ファイルのインデックスデータベースを作成・更新する必要がありますが、findコマンドと比較するとかなり早いです。
ちなみにfindコマンドはリアルタイムでファイルを検索して表示するので、そこまで高速ではないです。

ってことでlocateコマンドでファイルを探そう!と思ったら、Macではすぐにlocateコマンドが使えませんでした。。
今回は、Macでlocateコマンドを使う方法です。

Macでlocateする

こんな感じで怒られました。
first-locate
ま、updatedbコマンドしてないからなって思うとupdatedbコマンドがないと言われ。。。

updatedb

で、もう一度locateコマンドに描かれているところを読み返します。

WARNING: The locate database (/var/db/locate.database) does not exist.
To create the database, run the following command:

  sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist

Please be aware that the database can take some time to generate; once
the database has been created, this message will no longer appear.

簡単に訳すと...

注意!locate databaseが存在しません。
データベースを作成するなら、次のコマンドを実施してください。

  sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist

ってことですね。。updatedbコマンドじゃなかったです。
ということで、言われるがままコマンドを実施してみましょう。

一瞬で終わったので不安になったのでもう一度実行すると...

launchctl

裏でデータベースを作成しているみたいですね。

Macの容量にも左右されるので一概には言えませんが、5分程度経ったら改めてlocateコマンドを使ってみましょう。

after-locate

locateコマンドで結果が返ってきました。
rsyncd.confってないのか...この辺はまた記事にしよう。

これでSpotlight機能でも見つけられないようなライブラリファイル等を見つけることができました!

この記事がお役に立てば【 いいね 】のご協力をお願いいたします!
0
読み込み中...
0 票, 平均: 0.00 / 10
2,174
X facebook はてなブックマーク pocket
[2024.6.30 CentOS support ended] CentOS server migration solution

[2024.6.30 CentOS support ended] CentOS server migration solution

[2025.6.30 Amazon Linux 2 support ended] Amazon Linux server migration solution

[2025.6.30 Amazon Linux 2 support ended] Amazon Linux server migration solution

[Osaka/Yokohama] Actively recruiting infrastructure engineers and server side engineers!

[Osaka/Yokohama] Actively recruiting infrastructure engineers and server side engineers!

The person who wrote this article

About the author