.\" Copyright (c) 1980, 1990, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)strings.1 8.1 (Berkeley) 6/6/93 .\" jpman %Id: strings.1,v 1.2 1997/05/21 00:41:19 mutoh Stab % .\" .Dd June 6, 1993 .Dt STRINGS 1 .Os BSD 3 .Sh 名称 .Nm strings .Nd ファイル内の表示可能な文字のみ表示する .Sh 書式 .Nm .Op Fl afo .Op Fl n Ar number .Op Ar .Sh 解説 .Nm は、 .Ar file が指定されていればそのファイルを、指定されていなければ 標準入力を読み込み、一定以上の表示可能な文字 (デフォルト 4 文字) からなる 文字列を探して表示します。 これは、バイナリファイルの中にある文字列を調べるのに有効です。 .Pp オプションとしては以下のものがあります。 .Bl -tag -width Ds .It Fl a デフォルトでは、オブジェクトファイルのテキストセグメントとデータセグメント しか調べませんが、 .Fl a オプションをつけることでオブジェクトファイルの全エリアを対象とします。 .It Fl f 発見した文字列の前に、ファイル名を表示します。 .It Fl n 探す対象として、少なくとも .Ar number 文字以上の文字からなる文字列を指定します。 .It Fl o 発見した文字列の前に、10 進数のオフセット位置を表示します。 .El .Pp .Nm は、ランダムなバイナリを他のものから識別するのに便利です。 .Sh 関連項目 .Xr hexdump 1 .Sh バグ .Nm が使っている文字列検出のアルゴリズムは非常に原始的です。もし、 .Tn ASCII コードのシーケンスに似たマシン語体系を持った機種では、間違う事があるでしょ う。 .Sh 互換性 .Nm の昔のインプリメントでは、オブジェクトファイルのデータセクション のみ検索していました。これは、文字列などは通常、データセクションに置 かれたからです。しかし、最近のコンパイラテクノロジでは、テキストセクション にも文字列を置くようになったので、デフォルト動作をデータセクションと テキストセクションの両方を検索するよう変更しました。 .Sh 歴史 .Nm ユーティリティは .Bx 3.0 から登場しました。