strings command
觀看 help
執行
$ strings --help
或是執行
$ strings -h
顯示
Usage: strings [option(s)] [file(s)]
Display printable strings in [file(s)] (stdin by default)
The options are:
-a - --all Scan the entire file, not just the data section [default]
-d --data Only scan the data sections in the file
-f --print-file-name Print the name of the file before each string
-n --bytes=[number] Locate & print any NUL-terminated sequence of at
-<number> least [number] characters (default 4).
-t --radix={o,d,x} Print the location of the string in base 8, 10 or 16
-w --include-all-whitespace Include all whitespace as valid string characters
-o An alias for --radix=o
-T --target=<BFDNAME> Specify the binary file format
-e --encoding={s,S,b,l,B,L} Select character size and endianness:
s = 7-bit, S = 8-bit, {b,l} = 16-bit, {B,L} = 32-bit
-s --output-separator=<string> String used to separate strings in output.
@<file> Read options from <file>
-h --help Display this information
-v -V --version Print the program's version number
strings: supported targets: elf64-x86-64 elf32-i386 elf32-iamcu elf32-x86-64 a.out-i386-linux pei-i386 pei-x86-64 elf64-l1om elf64-k1om elf64-little elf64-big elf32-little elf32-big pe-x86-64 pe-bigobj-x86-64 pe-i386 plugin srec symbolsrec verilog tekhex binary ihex
Report bugs to <http://www.sourceware.org/bugzilla/>
觀看版本
執行
$ strings --version
或是執行
$ strings -V
顯示
GNU strings (GNU Binutils for Ubuntu) 2.26
Copyright (C) 2015 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) any later version.
This program has absolutely no warranty.
觀看 manpage
執行
$ whatis strings
顯示
strings (1) - print the strings of printable characters in files.
執行
$ man strings
會看到「說明」。
查詢 strings 放在那個位置
執行
$ whereis strings
顯示
strings: /usr/bin/strings /usr/include/strings.h /usr/share/man/man1/strings.1.gz
查詢 strings 屬於那個套件
執行
$ dpkg -S /usr/bin/strings
顯示
binutils: /usr/bin/strings
表示「/usr/bin/strings」是屬於「binutils」這個套件。
使用範例
執行
$ strings /bin/ls
執行
$ sudo strings /proc/1/environ
顯示
$ sudo strings /proc/1/cmdline
執行下面其中一個指令
可以找到相關的說明
/proc/[pid]/environ
This file contains the environment for the process. The entries are separated by null bytes ('\0'), and
there may be a null byte at the end. Thus, to print out the environment of process 1, you would do:
$ strings /proc/1/environ
以及
/proc/[pid]/cmdline
This read-only file holds the complete command line for the process, unless the process is a zombie. In
the latter case, there is nothing in this file: that is, a read on this file will return 0 characters.
The command-line arguments appear in this file as a set of strings separated by null bytes ('\0'), with
a further null byte after the last string.