Command line tip - look for strings inside binary files

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 - http://peter.upfold.org.uk/

Peter Upfold is a technology enthusiast from the UK. Peter’s interest in Linux stems back to 2003, when curiosity got the better of him and he began using SUSE 9.0. Now he runs Linux Mint 9 on the desktop, runs a CentOS-based web server from home for his personal website and dabbles in all sorts of technology things across the Windows, Mac and open source worlds.

Home » Articles »

Discussion: Command line tip - look for strings inside binary files

Home » Articles » Command line tip - look for strings inside binary files