'\" te .\" Copyright 1989 AT&T .\" Copyright (c) 1992, X/Open Company Limited All Rights Reserved .\" Portions Copyright (c) 2007, 2011, Oracle and/or its affiliates.All rights reserved, .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation.Original documentation from The Open Group can be obtained online at http://www.opengroup.org/bookstore/. .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation.In the following statement, the phrase "this text" refers to portions of the system documentation.Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group.In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document.The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.This notice shall appear on any product containing this material. .TH strings 1 "2011 年 6 月 8 日" "SunOS 5.11" "用户命令" .SH 名称 strings \- 查找目标文件或二进制文件中的可列显字符串 .SH 用法概要 .LP .nf \fBstrings\fR [\fB-a\fR | \fB-\fR] [\fB-t\fR \fIformat\fR | \fB-o\fR] [\fB-n\fR \fInumber\fR | \fB-number\fR] [\fB-N\fR \fIname\fR] [\fIfile\fR]... .fi .SH 描述 .sp .LP \fBstrings\fR 实用程序用于查找二进制文件中的 \fBASCII\fR 字符串。一个字符串由任意序列的 4 个或以上以换行或\fB空\fR字符结尾的打印字符组成。 .sp .LP \fBstrings\fR 在标识随机目标文件以及许多其他项时很有用。 .sp .LP 缺省情况下,字符串会查看内存中装入的程序段。程序段由节类型 \fBSHT_PROGBITS\fR 标识。内存装入的节由节标志 \fBSHF_ALLOC\fR 标识。使用 \fBelfdump\fR(1) 可显示文件的完整的节信息。 .sp .LP 使用 \fB-a\fR 选项可检查所有节。使用 \fB-N\fR 选项可检查各个节。 .SH 选项 .sp .LP 支持以下选项: .sp .ne 2 .mk .na \fB\fB-a\fR | \fB-\fR\fR .ad .RS 23n .rt 在整个文件中查找字符串。 .RE .sp .ne 2 .mk .na \fB\fB-n\fR \fInumber\fR \fB|\fR \fB-\fR\fInumber\fR\fR .ad .RS 23n .rt 使用 \fInumber\fR 作为缺省字符串长度之外的最小字符串长度,缺省字符串长度为 (\fB4\fR)。如果数字无效,将使用缺省字符串长度。 .RE .sp .ne 2 .mk .na \fB\fB-N\fR \fIname\fR\fR .ad .RS 23n .rt 仅在 ELF 节名称中查找。请参见 \fBelfdump\fR(1)。可以指定多个 \fB-N\fR 选项来查找多个节。 .sp 如果指定了 \fB-a\fR 或 \fB-\fR 选项,则会忽略所有 \fB-N\fR 选项。 .RE .sp .ne 2 .mk .na \fB\fB-o\fR\fR .ad .RS 23n .rt 等效于 \fB\fR\fB-t\fR \fBd\fR 选项。 .RE .sp .ne 2 .mk .na \fB\fB-t\fR \fBformat\fR\fR .ad .RS 23n .rt 写入前面带有文件开始处的字节偏移量的每个字符串。具体格式取决于用作 \fIformat\fR 选项参数的单个字符: .sp .ne 2 .mk .na \fB\fBd\fR\fR .ad .RS 5n .rt 以十进制写入偏移量。 .RE .sp .ne 2 .mk .na \fB\fBo\fR\fR .ad .RS 5n .rt 以八进制写入偏移。 .RE .sp .ne 2 .mk .na \fB\fBx\fR\fR .ad .RS 5n .rt 以十六进制写入偏移。 .RE .RE .SH 操作数 .sp .LP 支持下列操作数: .sp .ne 2 .mk .na \fB\fB\fIfile\fR\fR\fR .ad .RS 8n .rt 要用作输入的常规文件的路径名。如果未指定 \fIfile\fR 操作数,则 \fBstrings\fR 实用程序会从标准输入中读取。 .RE .SH 环境变量 .sp .LP 有关影响 \fBstrings\fR 执行的以下环境变量的说明,请参见 \fBenviron\fR(5):\fBLANG\fR、\fBLC_ALL\fR、\fBLC_CTYPE\fR、\fBLC_MESSAGES\fR 和 \fBNLSPATH\fR。 .SH 退出状态 .sp .LP 将返回以下退出值: .sp .ne 2 .mk .na \fB\fB0\fR\fR .ad .RS 6n .rt 成功完成。 .RE .sp .ne 2 .mk .na \fB\fB>0\fR\fR .ad .RS 6n .rt 出现错误。 .RE .SH 属性 .sp .LP 有关下列属性的说明,请参见 \fBattributes\fR(5): .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . 属性类型属性值 _ 可用性system/core-os _ CSIEnabled(已启用) _ 接口稳定性请参见下文。 .TE .sp .LP 包括除 \fB-N\fR 之外的所有选项在内的 \fBstrings\fR 实用程序由标准指定。请参见 \fBstandards\fR(5)。\fB-N\fR 选项当前未由任何标准指定。 .SH 另请参见 .sp .LP \fBelfdump\fR(1)、\fBod\fR(1)、\fBattributes\fR(5)、\fBenviron\fR(5)、\fBstandards\fR(5) .SH 附注 .sp .LP 用于标识字符串的算法是非常基本的。 .sp .LP 为了向后兼容,选项 \fB-a\fR 和 \fB-\fR 可互换。