Why Bother with the Shell?

You might have followed the instructions in this book and consider yourself an expert in Linux. But the real measure of a Linux user comes from your abilities at the shell.

Most modern Linux distributions prefer you to use the GUI to do nearly everything. To this end, they provide GUI tools for just about every task you might want to undertake. Ubuntu is strong in this regard, and you can configure a lot of things from the Desktop. However, it’s well worth developing at least some command-line shell skills, for a number of reasons:

It’s simple and fast: The shell is the simplest and fastest way of working with Ubuntu. As just one example, consider the task of changing the IP address of your network card. You could right-click the NetworkManager icon, select the relevant menu option, and then work your way through the Network Connection dialog box options. That will take at least a minute or two if you know what you’re doing, and perhaps longer if it’s new to you. Alternatively, you could simply open a shell and type this:

ifconfig eth0 192.168.0.15 up

It’s versatile: Everything can be done via the shell—from deleting files, to configuring hardware, to creating MP3s. A lot of GUI applications actually make use of programs you can access via the shell, although it isn’t always the case that you’ll find a GUI program that does the job of a well-crafted shell command. Sometimes you simply have to use the shell for a particular task.

It’s consistent among distributions: All Linux systems have shells and understand the same commands (broadly speaking). However, not all Linux systems have Ubuntu’s graphical configuration programs. SUSE Linux uses its own GUI configuration tool, as does Mandriva Linux. Therefore, if you ever need to use another system or decide to switch distributions, a reliance on GUI tools means learning everything from scratch. Knowing a few shell commands can get you started instantly.

It’s crucial for troubleshooting: The shell offers a vital way of fixing your system should it go wrong. Your Linux installation might be damaged to the extent that it cannot boot to the GUI, but you’ll almost certainly be able to boot into a shell. A shell doesn’t require much of the system other than the ability to display characters on the screen and take input from the keyboard, which most PCs can do even when they’re in a sorry state. This is why most rescue floppy disks or CDs offer shells to let you fix your system.

It’s useful for remote access: One handy thing about the shell is that you don’t need to be in front of your PC to use it. Programs such as ssh let you log in to your PC across the Internet and use the shell to control it. For example, you can access data on a remote machine, or even fix it when you’re unable to be at the machine’s location. This is why Linux is preferred on many server systems when the system administrator isn’t always present on the site.

It’s respected in the community: Using a shell earns you enormous brownie points when speaking to other Linux users. It is what professionals use, because it gives you greater power and control. Seen in this light, learning at least a handful of shell commands is vital to truly mastering your PC. The drawback when using a command-line shell is that it’s not entirely intuitive. Take for instance the command discussed earlier that changes the network card’s IP address:

ifconfig eth0 192.168.0.15 up

If you’ve never used the shell before, it might as well be Sanskrit written on the side of an ancient tomb. What on Earth does ifconfig mean? And why is the word up at the end?

Learning to use the shell requires learning terms like these. Hundreds of commands are available, but you really need to learn only about 10 or 20 for everyday use. The comparison with a new language is apt because, although you might think it daunting to learn new terminology, with a bit of practice it will all become second nature. After you’ve used a command a few times, you’ll know how to use it in the future.  lots of built-in help is available. The main thing to realize is that the shell is your friend. It’s there to help you get stuff done as quickly as possible. When you become familiar with it, you’ll see that it is a beautiful concept. The shell is simple, elegant, and powerful.