NAME strings - find and output the printable strings in a file SYNOPSIS strings [ -option ] [ filename ] ... option is one of a,-,o,p,t,v,e,c or a number. DESCRIPTION "strings" looks for sequences of printable characters in a file and outputs them, if they are longer than "number". Default for "number" is 4. If "strings" identifies a file as containing an object, it will only scan the initialized data segment of the object. If you specified either the "-a" or "-" flags it will scan the whole file. If there is more than one filename specified, the name of the file is output before the stuff from that file. If there is no filename specified "strings" will read from standard input. OPTIONS "-" or "-a" examine the entire file for sequences of printable characters. Default on UNIX (trademark of AT&T) systems is to examine only the segment of initialized data. On systems where such a segment does not exist, the options "-a" and "-" do not exist. "-o" precede each output string by its offset from the beginning of the file (in decimal). The number is output with (at least) 7 digits, filled with blanks. Then follows a blank, then the found string. If these 7 digits are not sufficent to hold the offset, "strings" will use 8 digits or as much as necessary (and possible :-). "number" only output sequences longer than or as long as "number". Only decimal values are accepted. "-p" prefix each output with the name of the input file. This is useful e.g. if "strings" is used on a list of files and "fgrep" is used to search for a certain string. When this string is found you will get the name of the file the string was found in. "-e" the next argument is interpreted as a filename, even if it starts with a "-". Thus "strings -e -a" will try to read from file "-a". "-t" TAB is considered a printable character. "-c" output only strings which end with a NUL or LF character. Most strings in C programs will result in strings like this. "-v" print information about "strings" version, including the flags with which it was compiled. This may be uninteresting to the normal user, but is quite informative when porting to another system. Nothing else is output, the program exits immediately afterwards. Options can be specified in a single word. They apply to all files specified. It is an error for an option to be specified twice. The following invocations are correct: strings -ao12 m1 m2 m3 strings -a -ot -12 m1 strings -a m1 -o m2 strings - -o strings core -a blabla -o rhabarber -12 The following invocations are incorrect: strings -a - BBB strings -aa m strings -12a14 core AUTHOR Michael Greim greim@sbsvax.uucp greim@sbsvax.informatik.uni-saarland.dbp.de DIAGNOSTICS Diagnostics are always written to file descriptor 2, i.e. if a file cannot be opened or malloc runs out of memory. If the user makes an error when invoking "strings", a table with the correct syntax will be output. If the output buffer overflows, the program tries to enlarge it using realloc. If this fails, it prints a message and exits immediately. BUGS "Strings" does not inform the user, whether it has found an object file or not. If you have a file which contains a long sequence of printable characters, e.g. about as long as to become as large as your computers memory size, "strings" might run out of memory. It will print "REALLOC error" and exit. If a file contains a magic number for object files, "strings" thinks it has found an object file and interpretes the bytes at a certain location as offsets into the file. This may lead to errors, but "strings" does not tell the user about it. The way to identify an object file, or even the concept of initialized data may vary with systems. When "strings" is compiled one can turn off this special feature (I_SPECIAL). Consequently the options "-a" and "-" are no longer valid. Invoke "strings" with an invalid option to get a list of possible options. If "strings" is invoked on the standard input it fills up its buffer before it outputs anything. If you enter a line at a time, it takes some time before you see the first output. If "strings" is invoked on the standard input, it does not try to recognize an object file, but acts as if the flags "-a" or "-" had been set. The option "c" will not get all C strings. If you use something like printf ("Say something\r\n"); and you specify "c" when invoking "strings" you will not get the string, because it does not end with NUL or LF.