Command line tip - look for strings inside binary files

  • May 28, 2007
  • Avatar for peter
    Peter
    Upfold

Occasionally if you're working with binary files (maybe you're doing software development for example), you might sometimes need to take a look through a binary file to find the strings that it contains.

Instead of trying to trawl through the rubbish and binary data that isn't a lot of use to you, you can use the strings command to search through the file for the intelligible information it contains.

For example, you could do this on a critical system program like ls.

$ strings /bin/ls

With GNU ls, you'll find a fair few strings in there, including:

This is free software. You may redistribute copies of it under the terms of the GNU General Public License .
There is NO WARRANTY, to the extent permitted by law.

Which is exactly the text you'll see if you run:

ls --version

Just a quick example to prove that it works!

Avatar for peter Peter Upfold

Home » Articles »