How to Use the strings Command on Linux

Share

Fatmawati Achmad Zaenuri/Shutterstock.com

Want to see the text inside a binary or data file?  The Linux strings command pulls those bits of text—called “strings”—out for you.

Linux is full of commands that can look like solutions in search of problems. The strings command definitely falls into that camp. Just what is its purpose? Is there a point to a command that lists the printable strings from within a binary file?

Let’s take a step backward. Binary files—such as program files—may contain strings of human-readable text. But how do you get to see them? If you use cat or less you are likely to end up with a hung terminal window. Programs that are designed to work with text files don’t cope well if non-printable characters are fed through them.

Most of the bytes within a binary file are not human readable and cannot be printed to the terminal window in a way that makes any sense. There are no characters or standard symbols to represent binary values that do not correspond to alphanumeric characters, punctuation, or whitespace. Collectively, these are known as “printable” characters. The rest are “non-printable” characters.

So, trying to view or search through a binary or data file for text strings is a problem. And that’s where strings comes in. It extracts strings of printable characters from files so that other commands can use the strings without having to contend with non-printable characters.

Using the strings Command

There’s nothing complicated about the strings command, and its basic use is very simple. We provide the name of the file we wish strings to search through on the command line.

Here, we going to use strings on a binary file—an executable file—called “jibber.” We type strings, a space, “jibber” and then press Enter.

strings jibber

strings jibber in a terminal window

The strings are extracted from the file and listed in the terminal window.

Read the remaining 54 paragraphs

Source : How to Use the strings Command on Linux