APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

2003/12/15 strings command

Extract printable strings from a file. The usual use is to look inside some data or program file to get possibly useful information out of it. It's also useful if you have a file that MIGHT contain garbage control characters and you just want to be safe.

Without any flags, strings doesn't necessarily search the entire file:

apl$ strings  -15 `which strings` | wc -l
apl$ strings -a -15 `which strings` | wc -l
apl$ strings - -15 `which strings` | wc -l

But on a Linux box:

bash-2.05a$ strings  -15 `which strings` | wc -l
bash-2.05a$ strings  -a -15 `which strings` | wc -l
bash-2.05a$ strings  - -15 `which strings` | wc -l

And on a BSD box, "-" and "-a" are equivalent:

bash-2.05a$ strings  -15 `which strings` | wc -l
bash-2.05a$ strings  -a -15 `which strings` | wc -l
bash-2.05a$ strings  - -15 `which strings` | wc -l

Got something to add? Send me email.

Increase ad revenue 50-250% with Ezoic

More Articles by

Find me on Google+

© Tony Lawrence

Kerio Samepage

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us

Beware of bugs in the above code; I have only proved it correct, not tried it. (Donald Knuth)

That's the thing about people who think they hate computers. What they really hate is lousy programmers. (Larry Niven)

This post tagged: