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.
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.
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 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:
Or all the links with:
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.
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:
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.
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:
or upload them with:
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:
or the filename, size, hash, etc, with:
plowshare is also a good alternative to the slow and excruciating jDownloader for those of you who are familiar with these services.
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).
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.
Did you find this tutorial helpful? Then please be generous and support Xmodulo!