Tired of using many different commands, each with dozens of flags, to transform text? Meet sttr, a command-line tool that can replace your whole text processing toolbox. Let's look at why this tool is making the "old way" of text processing look like hard labor.
Installing sttr
There are tons of ways you can install sttr on your Linux machine. The easy way is to use the installation script the developer provides.
Always verify the content of a Bash script before running it.
If you use the Snap package manager , run:
On Arch Linux , use:
Since sttr is made with Go, you can install it using Go as well if you have it set up.
Once installed, run the tool with this command:
You should get a similar output.
Trying the interactive mode
Launching the tool using the sttr command enters you into an input window. First, you need to enter your text. After that, to do a transformation on it, you need to enter two empty lines, as instructed by the tool. Once you do that, you're taken to a menu of all the available options. You can use the up and down arrow keys or the K and J buttons to go up and down the items. To navigate between pages, you can use the left and right arrow keys or the H and L keys.
This is the interactive mode. You can also enter this mode by using the appropriate flag, like this:
Since there are a lot of items here, you can filter the one you're looking for by pressing the forward slash (/) button. Once in the filter mode, start typing the name of the operation you want to perform on your text.
Once you have found your desired operation, press Enter and then select from the options. You can also press the Esc key to return. To see other options, you can press the question mark (?) button.
Encoding, hashing, casing, and other operations
sttr has so many operations, too many to cover here. So, let's go through the ones I found most useful. While you can certainly use the interactive mode, I found that using direct commands is much faster. You write the name of the operation and then pass your text as an argument.
sttr has support for many different encoding schemes, including base64 , base32, base85, HTML decoding, ROT13 cipher, and others. Let's see some examples:
For text that contains spaces, you put them inside double quotes. sttr supports popular hashing algorithms such as MD5 and the SHA series.
Text manipulation features are where this tool shines most. Think about casing. It supports many casing types to transform your text.
Other than that, you can also reverse text, count words, characters, lines, remove spaces and newlines, and so on. This also makes it a good choice to clean messy files or get some quick statistics.
Working with different types of files
If the text transformation felt impressive enough, then support for different file formats is the cherry on top. If you're a developer, converting between JSON and YAML is a common task. You can do that using sttr.
Likewise, you can convert a YAML file into a JSON file. Another useful conversion is from Markdown to HTML. You can then preview that content in a web browser by rendering the HTML file.
It doesn't just end at converting one type of file to another. You can perform special operations on particular types of files. For example, when sending JSON data through certain shells or APIs, you often need to "escape" it to avoid syntax errors. You can do that in sttr by passing that JSON like this:
The output should be a ready-to-use escaped version.
From my experience, sttr has saved me a ton of headaches of installing and jumping between multiple tools. If you're interested in knowing more about the project, check out its official GitHub .
