Is there any linux command to extracts all the ascii strings from an executable or other binary file? I suppose I could do it with a grep, but I remember hearing somewhere that such a command existed?

link|improve this question
feedback

4 Answers

up vote 28 down vote accepted

The command you are looking for is strings

Its name is quite self-explanatory, it retrieve any printable string from a given file.

man strings gives:

STRINGS(1)

NAME
strings - find the printable strings in a object, or other binary, file

SYNOPSIS
strings [ - ] [ -a ] [ -o ] [ -t format ] [ -number ] [ -n number ] [--] [file ...]

link|improve this answer
That is exactly what I was looking for, thanks. – Ethan Heilman Aug 7 '09 at 15:27
feedback

The command does exist, and is called.... strings!

link|improve this answer
feedback

The od command can do this:

od -c *filename*
link|improve this answer
3  
yeah, that does extract the ASCII characters, but it's not really the strings, per se. I think that 'strings' is more useful for the majority of cases. – user5336 Aug 7 '09 at 15:07
Ya, didn't know about that command, but I do now! AlberT got my '+1' :-) – Kyle Brandt Aug 7 '09 at 15:20
feedback

The strings command is the way to go for this particular type of problems. Sometimes you also have to pipe it out to grep.

For example:

strings somebinaryfile | grep textuwanttofind
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.