「ファイルシステム検索」の版間の差分

提供: ArchWiki
ナビゲーションに移動 検索に移動
(ページの作成:「Category:検索 en:File system search {{Related articles start}} {{Related|Core Utilities}} {{Related articles end}} このページではファイルシステム...」)
 
(Core Utilitiesへの転送ページ)
1行目: 1行目:
  +
#redirect[[Core Utilities]]
[[Category:検索]]
 
[[en:File system search]]
 
{{Related articles start}}
 
{{Related|Core Utilities}}
 
{{Related articles end}}
 
このページではファイルシステムを検索するのに使えるユーティリティを説明しています。
 
 
== find ==
 
 
''find'' は最初はとっつきにくく感じるかもしれません。また、ファイルの名前を引数として指定すると、ファイルシステムからその名前に一致するファイルを検索するようなコマンドだと勘違いしてしまうこともあるでしょう。そのようなプログラムを求めているときは下の [[#locate]] を見て下さい。
 
 
find ではディレクトリを指定してエクスプレッションに対してそれぞれのファイルをマッチさせます。これにより強力な"ワンライナー"を書くことができますが、上述のように操作は直感的とは言いづらいものなっています ([http://www.gnu.org/software/findutils/manual/html_mono/find.html#Common-Tasks] を参照)。
 
 
=== インストール ===
 
 
''find'' は {{Grp|base}} パッケージグループに含まれている {{Pkg|findutils}} パッケージに入っています。つまり、Arch ではデフォルトでインストールされます。
 
 
=== オプション ===
 
 
''find'' には約100ものオプションが存在しますが、以下の3つのカテゴリに分類することが可能です。
 
 
==== ファイルシステムトランスバーサル ====
 
 
These include the following,
 
* whether or not to follow symbolic-links
 
* Optimizations to perform during transversal
 
* Whether or not produce a certain kind of diagnostic output
 
 
==== エクスプレッション ====
 
 
Expressions are the meat and potatoes of ''find''. They allow to filter the filesystem for a, potentially explicit, list files. In mathematical terminology, they allow you
 
to define a [https://en.wikipedia.org/wiki/Binary_relation#Formal_definition/ relation] on a list of files. This is the fundamental distinction between find and other
 
search tools!
 
 
Expressions can be devided into the following categories
 
 
===== 判別式 =====
 
 
* ファイル名
 
* ディレクトリの深さ
 
* ファイルのタイプ
 
* 変更日時
 
* ファイルのパーミッション
 
* ファイルを引数として指定するシェルコマンド
 
 
===== アクション =====
 
 
* ファイルの削除
 
* シェルコマンドの実行
 
 
==== オペレータ ====
 
 
Operators allow you to combine sets of expressions together.
 
 
The power of ''find'' is the combination of this rich set of expressions.
 
 
=== 使用方法 ===
 
 
Any usage of find takes the following general form:
 
 
$ find [filesystem transversal options] [list of directories to search] [list of expressions to perform]
 
 
For every file listed under the given directories, each expression is performed, from ''left to right''. Thus, the order
 
in which expressions are listed is important!
 
 
== locate ==
 
 
{{ic|locate}} は名前でファイルを探すための Unix ツールです。あらかじめ作成したデータベースファイルを使って検索するので [[#find|find]] よりも高速に検索できます。欠点としては、データベースファイルを作成した後にファイルシステムに変更を加えても {{ic|locate}} からはわかりません。定期的に {{ic|updatedb}} コマンドを実行するようにして、データベースを更新する必要があります。
 
 
=== インストール ===
 
 
他のディストリビューションでは {{ic|locate}} や {{ic|updatedb}} は {{Pkg|findutils}} パッケージに入っていますが、Arch のパッケージには存在しません。使用したいときは、{{Pkg|mlocate}} パッケージをインストールしてください。mlocate は locate を新しく実装しなおしたツールで、使用方法は同じです。
 
 
{{ic|locate}} を使用する前に、データベースを作成します。root で {{ic|updatedb}} を実行してください。
 
 
=== データベースを最新にする ===
 
 
{{ic|mlocate}} をインストールすると、{{ic|systemd}} によって毎日スクリプトが自動的に実行されて、データベースが更新されます。root で {{ic|updatedb}} を実行することでデータベースの更新はいつでも手動で行えます。
 
 
時間を節約するために、{{ic|/etc/updatedb.conf}} を編集することで特定のファイルシステムやパスを無視するように {{ic|updatedb}} を設定することが可能です。ファイルのセマンティクスについては {{ic|man updatedb.conf}} を実行してみてください。デフォルト設定では {{ic|/media}} と {{ic|/mnt}} が無視されるようになっています ("PRUNEPATHS")。そのため {{ic|locate}} は外付けデバイスのファイルを検索しません。
 
 
== デスクトップ検索エンジン ==
 
{{Wikipedia/ja|検索エンジンの一覧}}
 
 
* {{App|Baloo|KDE のファイルインデックス作成・検索ソリューション。|https://community.kde.org/Baloo|{{Pkg|baloo}}}}
 
* {{App|Catfish|多目的のファイル検索ツール。|https://launchpad.net/catfish-search|{{Pkg|catfish}}}}
 
* {{App|Docfetcher|[[Java]] によるオープンソースのデスクトップ検索アプリケーション。|http://docfetcher.sourceforge.net|{{AUR|docfetcher}}}}
 
* {{App|Gnome Search Tool|ファイルを検索するデフォルトの Gnome ユーティリティ。|http://gnome.org|{{Pkg|gnome-search-tool}}}}
 
* {{App|Gnome Search Tool No Nautilus|[[GNOME Files]] や ''gnome-desktop'' を使わずにファイルを検索する ''gnome-search-tool''。||{{AUR|gnome-search-tool-no-nautilus}}}}
 
* {{App|Pinot|パーソナル検索とメタ検索ツール。|http://code.google.com/p/pinot-search/|{{Pkg|pinot}}}}
 
* {{App|Recoll|Xapian がバックエンドのフルテキスト検索ツール。|http://www.lesbonscomptes.com/recoll/|{{Pkg|recoll}}}}
 
* {{App|Searchmonkey|正規表現が使えるパワフルな GUI 検索ユーティリティ。|http://searchmonkey.sourceforge.net/|{{AUR|searchmonkey}}}}
 
* {{App|[[Wikipedia:ja:Strigi|Strigi]]|Qt GUI を持った高速なデスクトップ検索エンジン。|http://strigi.sourceforge.net/|{{Pkg|strigi}}}}
 
* {{App|[[Wikipedia:MetaTracker (software)|Tracker]]|オールインワンのインデックス作成・検索ツールとメタデータのデータベース。|http://projects.gnome.org/tracker/index.html|{{Pkg|tracker}}}}
 
 
== 参照 ==
 
 
* [http://www.gnu.org/software/findutils/manual/html_mono/find.html#Introduction/ GNU find 公式ドキュメント]
 
* [http://jvns.ca/blog/2015/03/05/how-the-locate-command-works-and-lets-rewrite-it-in-one-minute/ How locate works and rewrite it in one minute]
 

2016年11月12日 (土) 21:08時点における版

転送先: