What are better alternatives to basic command line utilities

The command line can be scary especially at the beginning. You might even experience some command-line-induced nightmare. Over time, however, we all realize that the command line is actually not that scary, but extremely useful. In fact, the lack of shell is what gives me an ulcer every time I have to use Windows. The reason for the change in perception is that the command line tools are actually smart. The basic utilities, what you are given to work with on any Linux terminal, are very powerful. But very powerful is never enough. If you want to make your command line experience even more pleasant, here are a few applications that you can download to replace the default ones, and will provide you with far more features than the originals.

dfc

As an LVM user, I really like to keep an eye on my hard drive memory usage. I also never really understood why in Windows we have to open the file explorer to know this basic information. Hopefully on Linux, we can use the command.

$ df -h

which gives you the size, usage, free space, ratio, and mount point of every volume on your computer. Notice that you have to pass in the "-h" argument to get all the data in human readable format (gigabytes instead of kilobytes). But you can replace completely df with dfc, which can, without any additional arguments, get you everything that df showed, and throw in a usage graph for each device, and a color code, which makes it a lot easier to read.

As a bonus, you can sort the volumes using the argument "-q", define the units that you want to see with "-u", and even export to csv or html format with "-e"

dog

Dog is better than cat. At least that is what this program declares. You have to give it credit for once. Everything that the cat command does, dog does it better. Beyond just outputting some text stream to the console, dog is capable of filtering that stream. You can for example find all images in a web page by using the syntax:

$ dog --images [URL]

Or all the links with:

dog --links [URL]

Besides, dog commands can also do other smaller tasks, like convert to upper or lower case, use different encoding, display the line numbers, and deal with hexadecimal. In short, dog is a must-have to replace cat.

advcp

One of the most basic command in Linux is the copy command: cp. It is probably as basic as cd. Yet it cruelly lacks feedback. You can enable the verbose mode to see which files are being copied in real time, but if one of the files is very big, you will be left waiting in front of your screen with no idea of what is really happening behind the scenes. An easy way to fix that is to add a progress bar: what advcp (short for advanced cp) does! Available as a patched version of the GNU coreutils, advcopy provides you with the acp and amv commands, which are "advanced" versions of cp and mv. Use the syntax:

$ acp -g [file] [copy]

to copy a file to another location, and display a progress bar.

I also advise using an alias in your .barshrc or .zshrc

alias cp="acp -g"
alias mv="amv -g"

The Silver Searcher

Behind this atypical name, the silver searcher is a utility designed as a replacement for grep and ack. Intended to be faster than ack, and capable of ignoring files unlike grep, the silver searcher scrolls through your text file looking for the piece that you want. Among other features, it can spit out a colored output, follow symlink, use regular expressions, and even ignore some patterns.

The developers' website provides us with some benchmark statistic on the search speed which, if they are still true, are quite impressive. And cherry on the cake: you can include the utility in Vim in order to call it with a simple shortcut. In two words, smart and fast.

plowshare

All fans of the command line like to use wget or one of its alternatives to download things from the internet. But if you use a lot of file sharing websites, like mediafire or rapidshare, you will be glad to know that there is an equivalent to wget dedicated to those websites, which is called plowshare. Once you install it, you can download files with:

$ plowdown [URL]

or upload them with:

$ plowup [website name] [file]

given that you have an account for that file sharing website.

Finally, it is possible to gather information, such as a list of links contained in a shared folder with:

$ plowlist [URL]

or the filename, size, hash, etc, with:

$ plowprobe [URL]

plowshare is also a good alternative to the slow and excruciating jDownloader for those of you who are familiar with these services.

htop

If you use top command regularly, chances are you will love htop command. Both top and htop offer a real-time view of running processes, but htop boasts of a number of user-friendly features lacking in top command. For example, with htop, you can scroll process list vertically or horizontally to see full command lines of every process, and can do basic process management (e.g., kill, (re)nice) using mouse clicks and arrow keys (without entering numeric PIDs).

mtr

One of essential network diagnostic tools for system admins is traceroute which shows layer-3 routing path from a local host to a destination host. mtr (short for "My Traceroute") advances the venerable traceroute by integrating ping with it. Once a full routing path is discovered, mtr prints running statistics of ping delays to all intermediate router hops, making it extremely useful to characterize link delays. While there are other variations of traceroute (e.g., tcptraceroute or traceroute-nanog), I believe mtr is the most practical enhancement of traceroute tool.

To conclude, these kinds of tools, which efficiently replace basic command line utilities, are like little pearl of usefulness. They are not always easy to find, but once you've got one, you always wonder how you survived for so long without it. If you know any other utility fitting this description, please share in the comments.

Subscribe to Xmodulo

Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.

The following two tabs change content below.

Adrien Brochard

I am a Linux aficionado from France. After trying multiple distributions, I finally settled for Archlinux. But I am always trying to improve my system by stacking up tips and tricks.

30 thoughts on “What are better alternatives to basic command line utilities

  1. Generally speaking getting in to the habit of replacing existing ubiquitous commands with non-standard equivalents is a bad idea, just like altering the default behaviour of commands using aliases is similarly a bad idea. The reason being that if you find yourself on an unfamiliar system, particularly one with no internet access or on which you have no privileges you are stuffed.

    So by all means be aware of these alternative commands, but understand how to use the standard ones. The same thing goes for editors. I use emacs for pretty much everything, but I know my way round elementary vi because sometimes - usually an emergency - it's the only editor available.

    • I agree.

      But on those occasions when you *do* have to use basic vi, isn't it painful?

      I used to tell my students that they really needed to learn "enough" vi to use it, but that otherwise it sucks...:-)

      • Absolutely. vi is more of a penance than an editor [dons asbestos suit], but you have to know enough of it for basic navigation, loading, saving, quitting etc. because it's the only editor pretty much guaranteed to be everywhere (actually you should also have a basic idea about how to use ed.

        Similarly people should ideally have some experience about how to drive a Linux box when it's single user at the # prompt. Enough at least to do an init, sync or shutdown.

      • It is silly to carry on the vi-emacs editor wars on these pages. In any case, I prefer vi to emacs, and I think vi is much better suited for you if you are a touch typist. I find it difficult to type three-letter combinations (as in emacs) without looking at the keyboard.

        • For the record I think vi is great because it's self-contained and loads quickly (although of course that advantage is now eroded by faster CPUs) and is ubiquitous. Emacs on the other hand is just so richly featured. Most of the basic editing commands in emacs only require Ctrl- or Alt- (on modern PC keyboard bindings) and are more or less wired in to my fingers now. Admittedly many of the rich array of Emacs (e.g. e-mail and calendar) are redundant now we all have WIMP interfaces rather than just a VT-100.

          Another downside to both vi and Emacs is that both were invented before the modern Undo/Cut/Copy/Paste convention of Ctrl-Z/X/C/V and so if I have been using something else like LibreOffice then my fingers are a bit confused for the first hour. I know I can override the bindings on Emacs, but it's not the same and as I originally posted making a tool deliberately non-standard is seldom a good idea.

          One advantage that both vi and Emacs have over more modern editors is that they can be used entirely independently of the mouse, making them much more efficient to use. The reason I changed from vi to Emacs many years ago is that Emacs allows me to do pretty much anything I want and has facilities like kill-rectangle and replace-regexp meaning I can do some fiendish edits which otherwise might require something like awk.

          • I didn't start the editor war :) I use vi and emacs equally and am comfortable in both in equal amounts.

    • Something like plowshare is not really an alternative or equivalent to wget. In that setting, the headline is inaccurate. The two programs provide completely independent functionality. So I think there is no danger of falling into a dependency trap in that instance.

      As for ed, I've been using Linux as my primary OS for 18 years, and I've never needed ed. Vi has always been enough. I do know how to use ed, and I was even pretty fluent with edlin (not identical, but similar) back when it was the only thing reliably available on DOS. But I have never used ed out of necessity. It helps a lot that busybox supports vi -- that takes care of 99% of emergency situations right there.

  2. Sorry, Windows now has a real shell, called Powershell or Monad. It finally escaped a few years ago, and is now a standard part of windows. Nobody knows how to use it, but it is feature infested, with dot.net as an integral part. 25 years late.

  3. > But you can replace completely df with dfc, which can, without any additional arguments, get you everything that df showed [...]

    OK, how do I do this in dfc?

    df .

    That tells me what filesystem my PWD (present working directory) is on and gives its size and fill status. I can't see a way to get anything similar in dfc.

    Without that it hardly gets me "everything that df showed", and I guess many admins will be used to that "just working", so dfc can hardly be considered a proper replacement for df.

    Similarly, while dfc does have the -p [fsname] option, that only works on the device/filesystem-name side of things. It has no option to do the same with the mountpoint. And on a modern system, fstab does UUID or LABEL based mounting, because the order the block devices appear in can differ between boots, so what might be /dev/sda6 this boot might be /dev/sdc6 two or ten boots from now, and /dev/sdg6 the boot after that. As a result, the mountpoint is as important if not more important than the device/filesystem name and without a way to get output for just a particular mountpoint, dfc is severely lacking in functionality, thus again not being an appropriate replacement for df. Of course if you know the mountpoint, you can easily pipe the dfc output to grep and grep for it, but as I demonstrated above, df can be fed any particular file or directory and will tell you its mountpoint along with filesystem usage information, so df can be used to /find/ the mountpoint, that actually being a primary reason to run it, while that's rather more difficult with dfc.

    That said, I hadn't discovered dfc at all yet, and now it's neatly tucked away in my admin-tools toolbox, so thanks. =:^) And I see you've already added htop to the list based on suggestions; very cool as I discovered from an article similar to this one some time ago, and it's nice to see the word spread. Further, you've already updated the article regarding where to get advcp based on user comments, so thanks to user comment and author responsiveness, the article is becoming even more useful than it was! I'm glad I subscribed to comments.=:^)

  4. I'd suggest perhaps adding mtr as an improvement on traceroute for anyone who still hasn't found it - incredibly useful when you're trying to figure out a problem getting to someone else's network or server.

Leave a comment

Your email address will not be published. Required fields are marked *

Current ye@r *