分享

linux命令strings(转自http://www.cppblog.com/prayer/archive/2009/07/22/90836.html)

 zenghui41 2010-11-19

linux命令strings(转自http://www./prayer/archive/2009/07/22/90836.html

linux命令strings,其man信息如下:
strings(1)                                        GNU Development Tools                                        strings(1)

NAME
       strings - 显示文件中的可打印字符

总览 (SYNOPSIS)
       strings
              [-a|-|--all] [-f|--print-file-name] [-o] [--help] [-v|--version] [-n min-len|-min-len|--bytes=min-len] [-t
              {o,x,d}[--target=bfdname] |--radix={o,x,d}] file

描述 (DESCRIPTION)
       For each file given, GNU strings 显示每个指定的 file 文件里包含的所有有4个(或者用选项指定的数字) 以上连续可打印字符的字符串, 在之后紧跟着一个不可打印的字符. 默认情况下, 它只显示目标文件 初始化和装载段的字符串; 对于其它类型的文件它显示整个文件里包含的所有字符串.

       strings 一般用来查看非文本文件的内容.

选项 (OPTIONS)
       在这里并列的长选项和短选项都是等价的.

       -a   --all      -不只是扫描目标文件初始化和装载段, 而是扫描整个文件.

       -f   --print-file-name       在显示字符串之前先显示文件名.

       --help 在标准输出打印strings 命令的选项列表,然后退出.
       -v    --version    在标准输出打印strings 命令的版本号,然后退出.

       -n min-len      -min-len       -bytes=min-len
              打印至少min-len 字符长的字符串. 默认的是4.
       -t {o,x,d}       --radix={o,x,d}       在字符串前面显示其在文件中的偏移量. 选项中的单个字符指定偏移量的进制是八进制, 十六进制,还是十进制.
       --target=bfdname        指定一种目标代码格式来代替你的系统的默认格式. 关于可用的目标代码格式 请参见objdump(1).
       -o     同 -t o.

------------------------------

strings - print the strings of printable characters in files.

       For each file given, GNU strings prints the printable character sequences that are at
       least 4 characters long (or the number given with the options below) and are followed by
       an unprintable character.   By default, it only prints the strings from the initialized
       and loaded sections of object files; for other types of files, it prints the strings from
       the whole file.
       strings is mainly useful for determining the contents of non-text files.


可见strings能输出文件中的可打印字符串(可指定字符串的最小长度),通常用来查看非文本文件(如二进制可执行文件)中的可读内容。比如:

[]#strings /lib/tls/libc.so.6 | grep GLIBC
GLIBC_2.0
GLIBC_2.1
GLIBC_2.1.1
GLIBC_2.1.2
GLIBC_2.1.3
GLIBC_2.2
GLIBC_2.2.1
GLIBC_2.2.2
GLIBC_2.2.3
GLIBC_2.2.4
GLIBC_2.2.6
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_PRIVATE

这样就能看到glibc支持的版本。

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多