Written by machiner
Friday, 06 July 2007 03:41
Page 1 of 3
The Command LineCertainly you've heard that running Linux is a whole lot safer, more reliable, robust, and secure than running Windows. Sure, this is true. You may have also heard that Linux is free. This is true, as well. However, you may always donate money or skills to the Linux distribution of your choice should you want to. You may also purchase any one of many Linux distributions through many online resources that charge for the media, plus a little somethin' somethin' for their troubles. However, don't feel like you must.
Before I get into the meat of this article I want to write that I'm not here to bash Windows or belittle it in any way, or its users. Honestly, you run what you like for whatever reasons you like. This article is for the curious, perhaps apprehensive, or new Linux user because there aren't many articles out there that will read like this one.
Linux is more a way of doing things than a simple operating system for your computer. There are certian things that accompany advanced computing that you may have never had to do in the past. Maybe on your Windows box. For instance, there is this terrific cloud hanging over the idea (and utilization) of the "command line" or terminal. I want to tell you right now that this, like all things sensationalized, has gotten way out of hand. Yes, you will probably enter at least 3 or 4 commands into the command line during your usage of Linux, but there is no rule that says that you must, nor do all of the Linux distributions force you to. But you can, and there is great satisfaction out of running the commands you want, in the fashion that you want.
The terminal, or command-line is one of those roadblocks, as I see it. The intention is to address it here in this article in such a way that it makes sense to those that may be put off by it. When the folks that make our operating systems and hardware agreed that a pleasant user experience was key to widespread personal computer adoption, desktop environments, Graphical User Environments (for example, Explorer in Windows is your GUI, your "shell") were integrated into the experience. It's simple enough. When your operating system is starting, one of the functions that it enables is your desktop environment. It's just the explorer desktop that you see, it's the "environment" that you are in. It enables you to see windows, click icons, run commands and all that through a simple and graphical experience. Back in 1983 when I was taking Basic computer language class in High School, the computers were cool and all, but they just showed you a black screen on the monitor. You could run commands and create programs all day, but there certainly was no point and click way to get things done. Noone worried about fancy graphics cards or any of that. Computing was tedious and boring. Unless you were a "geek". I was not.
But soon enough this all changed and the graphical desktop environment was born. When people refer to your desktop they are referring to what you see on screen when your computer boots. Your icons, a menu bar with the start button in it, your clock...all that. I just wanted to be clear on the GUI computing experience as opposed to computing from a terminal. It's really very simple - on a Windows box click - Start --> Run, and then type: cmd, and hit enter. The resulting boring and intimidating black box is the DOS terminal, another "shell". It's the command-line. In it you can do about anything that you can do by clicking on an option or button or whatever, in the GUI.
You see, when you are clicking those buttons in your GUI desktop, what is really happening is that behind the scenes your clicks are interpreted as commands. The same commands that you can type out into a terminal. What your pretty GUI desktop really is is an interface. A way for you to interact with your computer. For instance, by clicking. When you click your icon for your web browser, behind the scenes your computer is being told to run the program that this icon is pointing to. That icon is just a pretty little picture representing the actual link or address to a program location. An icon might be like the notes you leave yourself. You may use an image or a symbol or some abbreviation instead of writing a whole idea out. In a terminal you can do the same thing by issuing (typing out) the actual command instead of clicking its graphical representation. For example; you simply type: iexplore, and hit enter. This will start your Internet Explorer web browser.
Some people prefer the command line (Command Line Interface), or terminal, because it allows them to accomplish things faster. After all, that graphical interface must be loaded and system resources are required to create and run it. This means that you computer has to go find, assemble, and start all of the functions that create, or paint, your graphical interface. When the computer starts, or boots into, a terminal this is not necessary. There is no pretty interface to assemble. So you can see how you can save horsepower by using that ugly and boring terminal over the GUI. However, we like the GUI -- so I'm not telling you to forego it.
Another benefit of running commands from a terminal is that you can exercise more control. Programs have various alternative ways of starting. As well, you may start programs with certain variables. For instance, if I want to run my web browser, without starting the built-in email function it has I might open my terminal and run Opera with this command:
When starting Opera by clicking on its icon I don't have this ability. By the way, the command that I just typed here is different on your Windows box. There you have to type the whole address to Opera, like: C:\Progra~1\Opera\Opera.exe. You can change this by telling your computer where Opera is that you may simply type Opera to start the program. On Linux you don't need to add programs to your environmental variables like this -- but you can for those that you need to.
I hope that you are pretty clear about your graphical user interface (GUI) now. Most operating systems have one, or many. Certainly it is something that you have always used on your Windows box (you know, unless you go way back) and have just taken for granted. Never gave it a second thought. There are many ways to "interface" with your computer. When you slide your ATM card through a terminal commands are run on a relatively simple computer. You command it through the number pad interface, or by pressing the enter or cancel buttons on the ATM. When you enter your reheat time in your microwave, you are using another interface to instruct the limited operating system that runs your microwave. By hitting the 4:23 buttons and go, or cook, or whatever, you are commanding your microwave to complete a task.
I use my terminal all of the time. It really is very convenient. Sure, I have a desktop environment (xfce4) installed so I also have a pretty and functional GUI to interface with my computer -- but sometimes that terminal is just so handy to have around. In fact, when my desktop starts, one of the programs that starts along with it is called "tilda". Tilda just keeps a terminal handy for me. It drops down from my menu bar and I can dissappear it with a quick F2 press. But I only do that after I press the "up arrow" key so I can run a remembered command. The command I like to run after my desktop starts is the one that plays music. Remember that commands (programs) can be run with options; variables. We call them options or switches or flags. Well, I run "mpg321" the program, with the option that is the address for the internet radio station that I like to listen to. So, within a second I am grooving on some funky Chicago blues. I guess that like anything, this "terminal" interface simply takes a bit of getting used to.
It's important to understand a little about your computer. It is just a bunch of hardware assembled to run together. Providing your computer with a brain -- a memory controller, video capabilities, sound, network connections all that. Just hardware. this hardware is taken advantage of by your operating system. It gives you a very simple way to control your hardware and it also allows programs to be run -- which also might use your hardware. Your firewall monitors your internet connection. So, it focuses on the way that your computer is able to connect to a network, your network card. Your phone line or cat-5 cable plugs into your "nic" card. The Display component in your Control Panel attaches (so to speak) to your video card enabling you to control various aspects of it. Your computer itself interfaces with your hardware on many levels, but you always get a simple way to control it through your GUI, or by typing commands into a terminal.
Earlier I wrote that you might never have to see your terminal on your Linux box. This is mostly true. Let's talk about an example when you would see it in action but not necessarily because you opened it and are giving your computer commands.
Remember earlier when I wrote that your GUI was an interface by which you command your computer. Well, an example to see this in action is by running Synaptic on your Debian box. Synaptic is the graphical interface to the actual program doing the work - apt. You can run apt the simple from your terminal: apt-get , or you can run apt through Synaptic by clicking a menu button, or entry in your menu list. Go ahead, open Synaptic. When you click the Reload button what is happening is that Synaptic passes this command to your computer: apt-get update. You simply clicked it instead of typing it. After you have decided what program to install and you click Apply, you will see a box open. If you click the arrow on the left side of the box you can see a terminal drop down. Many programs completely hide their backround terminal actions but Synaptic opens it up for you. You can see a list of actions scrolling by as Synaptic runs the commands you just clicked it to do. It is updating, download and installing. Instead of typing: apt-get install gnump3d in a terminal that you opened, you searched for it, chose to install it, and applied it in Synaptic instead. It just opens the terminal for you as a bonus so you can configure any programs that need it as they install. Becuase the GUI is really passing on all the clicks you give it as actual commands to the real program operating behind the scenes.
We might separate the terminal and GUI functions by calling them the front-end and the back-end. You may have heard people referring to these in the past. The front-end is your graphical interface, the back-end is the actual program, hidden or obscured from your view by the pretty front-end. Synaptic is the front-end to apt, the back-end. This isn't true for all programs, of course. For instance, Microsoft Word is not a front-end graphical user interface. Word is a GUI program and that's that. Some programs are only crafted to run in the GUI space. On my Linux box, many programs are CLI programs designed to be run from the terminal, but many of those have a GUI front-end for those of us that would rather compute in this space.
If you would like I guess you could think of the CLI as the old way to run your computer and the GUI s the new way. There used to be MS-DOS, then we had Windows. I hope that your terminal, or CLI, apprehensions are allieviated now. However, you will hear it mentioned all of the time when people, especially those unfamiliar or very new to this concept, mention Linux. You can dismiss it all day because you can run Linux and not be forced to configure obscure programs or run obscure command line utilities through the terminal if you don't want to. Depending on which Linux distribution you choose to run, there are GUI counterparts to these commands. You may configure and run your Linux box completely through your GUI all day - just like in Windows. So you can now really see that this "roadblock" does not need to stand in your way.
Last Updated on Thursday, 19 March 2009 19:56