Talking with the expert: Take control with the Linux command line

Linux expert William E. Shotts Jr. wants more Linux users to discover the command line and tap the advanced functionality below the GUI.

This Content Component encountered an error

While many systems administrators have a familiarity with the Linux operating system, they may not venture beyond the familiar graphical user interface (GUI). And that would be a mistake, according to William E. Shotts Jr., author of “The Linux Command Line: A Complete Introduction.” 

An avid Linux user for more than 15 years, Shotts wants more Linux users to discover potential of the command line, tucked just beneath the GUI. In this Q&A, Shotts explains that a few keystrokes on the command line will tap into Linux’s advanced functionality, allowing administrators to be more efficient by finishing complex tasks in less time.

What can someone who isn’t familiar with the command line expect when they use it?
William E. Shotts Jr.:
In general, a command line implies a steep learning curve. A typical Linux installation will have a thousand or more command line programs that the user can employ. In addition, the shell — the program that accepts commands from the user — has a large number of features. Learning all of this is difficult, especially for someone coming from outside as Windows users typically do.

The reason I wrote the book was to address this problem. Surveying the available online learning resources, I was struck at how much prior knowledge was assumed and how many of the books and websites treated the material in what I call a “systematic” fashion. By this I mean that it's written based on its list of features. Documentation written this way simply covers all the program features in a systematic order, not one based on how a user will actually experience it.

The bash manual page is perhaps the most extreme example of this. While it covers each feature of the shell in a logical and organized manner, it is completely unintelligible to a new user. I approached the problem by trying to visualize what the new user brings to the table in terms of prior knowledge and build upon that in a series of small steps, demonstrating one feature at a time and explaining its relation to the big picture and in some cases, its origin and history.

Another problem was completeness. Other books and resources tend to focus narrowly on one program or set of programs. I wanted to teach the user how to “live” on the command line, explain how the key features work and illustrate a wide variety of tasks that you can perform with it.

I would be lying if I were to say that the command line is easy to learn. It's not. Some parts of the command line interface are incredibly arcane. But the effort spent to learn it is time well spent. It makes the Linux environment so much more powerful and useful. Another advantage to learning the command line is that it's a durable skill. Unlike so many other computer skills that come and go every few months, the command line has staying power. It is likely that what you learn today will still be relevant 10 years from now.

In today’s world, it seems there is more emphasis on a streamlined GUI. What is the advantage of using the command line?
W.S.: There is an old saying, “Graphical user interfaces make easy tasks easy. Command line interfaces make difficult tasks possible.” I have nothing against GUIs. I am writing this on an Ubuntu desktop using Mozilla Thunderbird.

But there is a problem with GUIs. You are limited by the imagination of the designer. If the designer did not anticipate the problem you are trying to solve, it is likely the graphical program will be unable to accommodate you. Contrast this with the Linux way of doing things. Linux, being a Unix-like operating system, follows the Unix philosophy: You are provided with a large collection of small tools you can connect together in interesting and useful ways to solve your problem. Solving your problem with the command line often won't be easy, but it will often at least be possible.

Another problem you sometimes see has to do with problem scale. I once joked that today's computers didn't seem to be powered by electricity anymore, rather it appeared they were being powered by the “pumping” action of the mouse — all that pointing and clicking. GUI programs often excel at performing small tasks, like copying a single file from one place to another. But say your problem is larger, like “copy all the HTML files belonging to a particular user, but newer than this file to another folder, oh, and compress each file individually.” You might be willing to do that with a GUI for a handful of files, but what if there are hundreds — or thousands? It's this kind of problem the command line is really good at.

What are some of the overlooked yet powerful commands for someone tasked with administering a Linux server?
W.S.: In my book, I go after the Unix “portability” argument. This line of reasoning says every script should be able to run on any Unix-like system. This has led some administrators to write everything as if they were still using the shell as if it was still the early 1990s, rather than fully exploiting the full feature set of bash, the default shell found in most Linux distributions. I think that many Linux command line users, even experienced ones, fail to realize that the shell supports arrays, can perform tests based on regular expressions, and can do a variety of integer math operations for example.

In a networked business environment, what advantage does Linux have over other operating systems?
W.S.:
The technical advantages of Linux are well known and been the subject of discussion for many years.

As a Linux and Free and open source software (FOSS) advocate, I am drawn to Linux for philosophical reasons. This came about as a result of my early exposure to computers. I did my first computer work in the mid-1970s as a design student at Syracuse University. I was writing programs on punch cards to make an IBM System/370 mainframe produce drawings on a plotter. After college, I got an early microcomputer and started doing the same thing at home, only without the punch cards. I grew up in an age where all the computers in the world were controlled by big business and big government, so the development of “personal” computers was a really big deal. Today, of course, computers are everywhere and we take them completely for granted.

But to me, the great benefit of owning a computer is the ability to control it. You can write your own software if you wish and your computer has no secrets, no hidden agendas. You can know everything about it if you care to. This freedom is useful to individuals and it is good for enterprises. If you want to have some control over your destiny, at least as far as your computing goes, you want to use an operating system that you can control, a system like Linux.

What are the advantages of a Linux-based system in a business setting?
W.S.: The control that you can achieve with Linux provides powerful advantages. For example, you can compile custom kernels that are tuned to your specific performance needs. You are free to obtain support from a variety of vendors, or if you have the capability, do it in-house. If a particular piece of software is not to your liking, you are free to change it, or hire somebody to do it for you.

Freedom is not without its costs. In the Linux world, users are participants, not just passive consumers, and participation often involves time and effort.

What are some of the new commands in later versions of Linux that may not be on the radar of rank-and-file administrators?
W.S.:
That's a hard question to answer. There are new ones all the time. If you hang out on Sourceforge, for example, you see that a blizzard of new software and updates to existing programs are produced daily.

In addition to the new programs being developed, I would urge users to study and explore the programs they are already familiar with. As I discussed earlier about bash, many of the common programs you already use probably have new or undiscovered features that the clever administrator can make use of to solve their day-to-day tasks.

For more information about “The Linux Command Line,” please visit the book page on the No Starch Press site.

This was first published in February 2012

Dig deeper on Introduction to Linux system administration

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchDataCenter

SearchServerVirtualization

SearchCloudComputing

SearchEnterpriseDesktop

Close