2012-08-15 00:12:08

Hardly known

Most Linux and some Ubuntu users know a certain set of command-line programs for interactive shell usage. Most importantly, there are the standard tools from the GNU core utilities which cover many aspects of everyday's work. You'll find these tools preinstalled on almost every Linux-based desktop or server system (embedded systems often tend to use all-in-one tools like BusyBox as a replacement for the core utilities).
Additionally, some of the commonly used tools like grep or strings are found in separate packages, which are also available on most systems. Thats why these programs are already thoroughly discussed in many books, blogs or internet forums. Yet, there are some hardly known, but useful shell programs that even seasoned Linux users might not know. This blog post will introduce two of these tools I consider to be quiet convenient for their special purpose.
The first one, iprint, might be one of the smallest pieces of software available in the Debian repositories. The source code of this handy utility consists of 23 lines of C code, the compiled ELF executable occupies about 6KB of precious disk space on my system. Still, if you're a programmer, you might consider these 23 lines useful for your work: i <arg> shows the decimal, hexadecimal, octal and binary representation of arg. If the value of arg corresponds to a printable ASCII character, the respective character is printed as well. If you precede arg with 0, 0x or 0b, arg is considered to be an octal, hexadecimal or binary value. Of course, you may pass multiple values to iprint in one call.
The second tool is somehow related to grep. One thing I like especially about grep is the possibility to highlight the matches in most terminals with the use of ANSI escape codes. For some purposes however, I wanted to have a tool that highlights specific keyword without filtering the input text for these keywords. A quick internet search showed, that histring might be exactly what I was looking for. Unfortunately, many hyperlinks pointing to projects pages for histring were no longer available. The GRML repository however, did not only have a compiled version of histring available, it also provided the source code. So after compiling, you may invoke histring more or less just like grep - support for case-insensitive matching and regular expressions is already included. ;)


Posted by haui | Permanent Link | Categories: linux