October 31, 2014
 
 
RSSRSS feed

Sobell on the Bourne Again Shell and the Linux Command Line

The Fate of the Command Line

  • November 21, 2005
  • By Ibrahim Haddad

LinuxPlanet: Mark, is the command line dead?

No, not at all. For some people, for some tasks, it is easier and more straightforward to use a graphical interface. It really depends on what you want to do and who you are. The difference between a GUI and the command line is like the difference between an automatic and a stick shift. I drive a stick because it gives me more control over the car and gives me more of a feel of what the car is doing, how it is performing.

Of course this discussion assumes that you are working with files at a basic or system administration level. Some applications have GUIs and may have no, or a very primitive, command line interface. It makes no sense to try to run these apps from the command line.

One thing that is nice about the command line is that it gives you access to hundreds of utilities. Right on the command line you can use a pipe to combine utilities to perform a task that no one utility is set up to do. Here is a quote from my ... Linux Commands, Editors, and Shell Programming book that talks about pipes and how they connect processes:

"A process is the execution of a command by Linux. Communication between processes is one of the hallmarks of UNIX/Linux. A pipe (written as a vertical bar, |, on the command line and appearing as a solid or broken vertical line on keyboards) provides the simplest form of this kind of communication. Simply put, a pipe takes the output of one utility and sends that output as input to another utility. Using UNIX/Linux terminology, a pipe takes standard output of one process and redirects it to become standard input of another process. Most of what a process displays on the screen is sent to standard output. If you do not redirect it, this output appears on the screen. Using a pipe, you can redirect the output so that it becomes instead standard input of another utility."

For example, you can combine the ls command, which lists the files in a directory, with the wc -w command, which counts words, to count the files in a directory:

     $ ls | wc -w
     45

In the realm of Linux system administration, the GUI tools are often built on top of the command line tools, so you gain no real advantage from the GUI tools. Except of course you get to point and click. Frequently you can do things from the command line that you cannot do from a GUI sys admin tool.

Sitemap | Contact Us