6 More Unique Linux Utilities You Forgot About | by Tate Galbraith | Dec, 2022

once again to the depths of /usr/bin

photo by lucas Feather unsplash

We’ve been down the Linux binary rabbit hole before and we’re about to go up again. In this article we are going to dig even deeper into the dark corners of /usr/bin And dust off some of the more intriguing gems. We’ll explore some unique and interesting programs that may seem obsolete at first glance, but are actually still quite useful today.

Let’s put our explorer hats back on and discover even more great things Linux has to offer.

First is a very neat little utility that will help you wrap input lines to specific lengths. The length can be defined in bytes or in spaces. using the fold The utility lets you quickly tame files with different run-on lengths.

For example, let’s say we have an input line that is six characters long. We want to limit each line to only five characters and wrap the rest. using the fold We can do this with the following command:

echo "123456" | fold -w 5

The corresponding output should be:


Now we can quickly constrain some text to conform to our length restrictions. This is really handy if you want to break up long streams of text or enforce line length limits on code or other configuration files.

check it out Wiki For more information on using fold,

This is another super useful formatting utility. column The utility helps you create columns in text output and even generate entire tables from the command-line.

There are other ways to achieve the same thing using utilities awk But, he column The utility has been tailored for this specific use so that it is incredibly simple to use, and remember the syntax for.

If we want to create a simple table based on a few rows of input, we can execute the following command:

echo -e "one two three\n1 2 3\n111111 222222 333322" | column -t

The output of this command should look like this:

one     two     three
1 2 3
111111 222222 333322

As you can see, the output is automatically formatted into neatly aligned columns. This creates a smaller table in the output and will automatically resize based on the length of each input line.

If you’re working with a slightly longer set of unstructured data on the command-line and you want to quickly bring some tabular order, this utility is a life saver.

man page For column There are unique ways to reduce more usage details and different inputs.

you must have heard about newgrp command. This command executes the command as in the other groups, but there is an even simpler utility that can accomplish the same thing. sg The utility lets you directly execute commands using the permissions of another group that you specify. You don’t need to pipe anything or change your existing shell groups, you just specify a group and command.

for execution ls From admin Group, you will pass the following:

sg admin ls

it will switch ls command to run using the permissions of admin group. Once the command exits you will be returned to the normal group permissions you had before execution.

sg The command is helpful for quickly switching contexts to test new group permissions or to run programs from another group.

check it out man page for more usage information.

xxd The utility is one of several ways to dump hexadecimal on Linux. There are a number of utilities that have similar functionality, but xxd The program is slightly different. Added advantage is that you can dump and restore hex using this utility. There are also a lot of configurable flags and you can patch on binary files as well.

Let’s say we want to take a hex dump of the following file name foo,


All we have to do is provide input and xxd will encode the file stdout automatically (a handy feature by default for small input files):

xxd foo

00000000: 3132 3334 0a35 3637 380a 1234.5678.

You can also output directly to a dump file by passing an additional filename parameter:

xxd foo bar

This will send the hex dump to a file titled bar,

man page for xxd Is available here,

This handy little utility comes from the same family as the venerable ps The utility we all know and love. pwdx The utility will allow you to get the current working directory of a running process. All you have to do is pass it the PID and then it will tell you where that process is running from.

Suppose we want to find where cron The process was working on our machine. First we need to find out the PID using ps hence:

ps aux | grep cron

> root 612 0.0 0.0 7260 2708 ? Ss May06 0:11 /usr/sbin/cron -f

Here we can see that the PID of cron Is 612, Now all we have to do is determine the working directory of that process by passing pwdx hence:

sudo pwdx 612

> 612: /var/spool/cron

since cron is a system process, you must sudo to get information about it. once the command completes we are left with the current working directory cronwhich is /var/spool/cron,

This can be a very valuable troubleshooting tool, especially if you’re chasing down directory scoping problems. a quick check with pwdx and you can find out exactly where a process is thinking It should be running from.

see the man page for pwdx Here,

This powerful little program might not do what you think it does at first glance. It has been available in Linux for decades and even dates back to version 6 of Unix from 1975.

write The utility actually lets you send messages to other users on the same system. You can target any other logged in user and send them a message. Provide a username and you’ll be dropped into an interactive shell to type any text you want them to. Everything you type (including newlines) will appear on the console of the target user.

Here’s a quick example:


This will drop you into an interactive console to send a message to the relevant user. Keep in mind that this is an aggressive way of sending messages to other users. They’ll immediately start receiving the text you’re entering on their console. They will not be given any warning or prompt to accept it. It will appear as if their terminal is haunted. They will also be unable to reply because it is a one-way communication.

Although there are better ways to handle inter-user messaging nowadays, it is a part of computing history. I’m sure there could still be some creative (and nefarious) uses for it today.

check officer man page here,

Leave a Reply