Previous Page
PCLinuxOS Magazine
Article List
Next Page

A Lesson: Why It's Important To Learn The Command Line

by Paul Arnote (parnote)

With today's modern desktops, using Linux has never been easier. Linux is no longer the solitary bastion of computer geekdom. The well thought out and user friendly graphical user desktops available for Linux insulate many users from the often perceived difficulty of the Linux command line. Running Linux is no more difficult than running any of the commercially available operating systems. Today, many Linux users can control their hardware and favorite operating system without ever having to touch or look at a command line prompt.

As a result, many Linux users don't even bother to learn how to operate or navigate Linux from the Linux command line. To some of those users, just opening a terminal session is wrought with anxiety, fear and trepidation.

But what would you do if, all of a sudden, your favorite graphical desktop stopped working properly? Would you be able to "fix" your beloved graphical desktop from the command line? Unfortunately, for many Linux users, the answer to this question is a resounding NO.

Disaster Hits Home

Let me use a personal account of something that happened to me not all that long ago. Without some prowess and ability to utilize every tool at my disposal -- including the command line in a terminal session -- I'm not sure that I'd have been able restore my desktop to fully functional status, without having to do a full reinstallation.

I don't keep it any kind of huge secret that my favorite desktop environment is Xfce. I have the Xfce desktop installed on most of the computers in my house (and that's quite a few). But being the magazine editor, I also have one computer that has a "bare metal installation" of KDE. I also have full installations of LXDE, Mate and e17 in VirtualBox.

One day in the not too distant past, I was updating KDE on that particular computer. The update from Synaptic seemed to go without a hitch. However, on that particular day, for some reason, I didn't immediately restart the computer. Not too long after I finished the update, plasma-desktop crashed. It didn't just crash. It crashed H-A-R-D. Please don't get me wrong -- this is not an attempt to malign KDE. It just happens to be that this problem occurred on my KDE installation.

I thought it would be a simple logout then log back in, and my desktop would be back just the way I had it configured. Nope. That wasn't to be. When my KDE desktop reappeared, my wallpaper was there, along with the YAWP desktop applet. That was all. I knew other things were running. I was getting notifications that Yakuake and my wireless connection had started, and I was getting email notifications of new emails from checkgmail, which I also run.

However, I had no panel. Nada. Not even a sign or hint of a panel. All of my panel launchers were gone. Also gone was the PC menu, from where you can typically launch all of your programs. No task area. No notification area. Just a big empty spot (now filled in with just the wallpaper) where my panel used to be.

In my mind's eye, I could easily imagine the horror and panic a less experienced user might experience. Trust me, even for as long as I've been using Linux (including the command line), the situation caused a fairly good sized lump to form in my throat. So now it was time to put on my detective hat and figure out what went wrong.

Right clicking on the desktop, I discovered that I still had access to the context menus. First, I tried to launch KDE's "Configure Your Desktop" control panel. My plan was to simply eliminate and then rebuild my panel. But no, the control panel wouldn't launch. It complained about not being able to find a library named icu18n. I searched through the PCLinuxOS forum (on another nearby computer) and discovered what package provided that particular library.

I then returned to the computer that has KDE installed on it. Since I received the notification that Yakuake had successfully started, I tried the keyboard shortcut that caused Yakuake to open (I love having a Quake-style drop down terminal just a keystroke away). Phew! Yakuake opened with a familiar command line prompt. Because I had just run updates from Synaptic, I knew (hoped?) that I had an up-to-date package list. I also knew, thanks to the notifications, that I also had wireless access.

Armed with the name of the package that contained the missing library file, it was time to reinstall the library from the command line. Also, knowing that only the root user has the necessary privileges to install stuff from the repository, I knew that I could do this from the command line only if I performed this task as the root user.

First, I entered su, followed by the root user's password on my system. Success! The command line prompt changed to red. Next, I entered apt-get install [package-name] at the root prompt in Yakuake (substituting the name of the package that contained the icu18n file for [package-name]). With the package successfully installed, I restarted the computer.

With bated breath, I eagerly awaited the resurrection of my seriously ill KDE desktop. But no, it wasn't to be. It still appeared as it had before, still without a panel. Drats! But now, I had a fully functioning KDE Configure Your Desktop. There were no more complaints of icu18n being AWOL.

Out of curiosity, I logged into KDE as the root user. I wanted to see if the root user account still had a panel. If it did, then I could safely deduce that the problem was with a file in the /home directory of my user account. Otherwise, it would indicate that there was a problem with some of the core KDE files. Tada! The root user account still had a panel.

Whenever a new user account is created, each user account is created with the same configuration and options. It is then up to the individual user to tailor the appearance and configuration of their desktop. Anyone who has been around for a while (and paying attention) will/should know that those basic user configurations are stored in /etc/skel. If you didn't know that, you do now.

From a previous issue I had on KDE, I knew the location and name of the configuration file that controls a lot of the plasma desktop applets on my computer. The path and filename of that file is ~/.kde4/share/config/plasma-desktop-appletsrc. It also happens to control my panel and the panel's notifications area.

I logged back into my normal user account. First, I opened the file in a text editor, but couldn't see anything flagrantly wrong. So, instead of trying to debug it (which could have taken hours), I renamed the existing plasma-desktop-appletsrc file by appending ".new" to the end of it. Since there was already a backup file right next to it, I removed the ".bak" extension on the file, the logged out and back in. Sure enough, I had a panel back on my desktop. But that backup copy was from the one that I had problems with before. I then renamed that file to have an ".old" file extension.

So, I logged back into the root user account, and went to the default configuration files in /etc/skel. I found the plasma-desktop-appletsrc file there, and copied it to my normal user directory (in the path listed above … the file has to be in the right place).

My KDE4 desktop, after resurrection.

Logging back out of the root user account, I logged back into my normal user account. Lo' and behold, I now had a panel again on my desktop. Yay! All I had left to do was to change my wallpaper from the default wallpaper that was displayed, and restore my YAWP plasma applet back to the desktop.

The Value Of The Command Line

In this instance, having some command line knowledge -- specifically, knowing how to reinstall the missing icu18n library file with apt-get -- was key to resurrecting my KDE desktop. I also don't underestimate the value of knowing something about the configuration files for KDE. Without that knowledge, my only solution would have been to reinstall KDE.

So, where can you learn how to use the Linux command line? The first place to look would be to download The PCLinuxOS Magazine Command Line Interface Intro Special Edition from the magazine's website. Pete Kelly, a.k.a. critter, created an awesome 12-part introduction to the command line interface that walks a user from the very basics of command line use through more complicated commands and topics.

Another excellent source of information to learn the Linux command line is The Linux Command Line, by William E. Shotts, Jr. It's a free download, released under the Creative Commons-Attribution-Noncommercial-No Derivatives 3.0 license. This 527 page PDF ebook starts from the very beginning and walks you through all aspects of the Linux command line.

Sometimes, you just need a quick memory jogger, and that is where the Bash Cheat Sheet comes in handy. This PDF document doesn't provide any in depth explanations. Rather, it just provides the command with a very brief explanation.

Linux Fundamentals, by Paul Cobbaut, is another all inclusive PDF ebook that will be useful for Linux users of all experience levels. Everyone from the newest Linux noob to the most hardened-in-the-trenches veteran will find something useful within its pages. This ebook was just updated in August 2013, so the data is very up-to-date.

Introduction to Linux: A Hands on Guide, by Machtelt Garrels is a 223 page PDF ebook that covers all aspects of working with Linux, including some command line usage. It is released by The Linux Documentation Project, a.k.a. TLDP.

If you are interested in proceeding on to creating your own bash scripts (it would be best to learn your way around the basic command line first), then the Advanced Bash Scripting Guide, by Mendel Cooper, is the book for you. This 907 page PDF ebook covers all things related to creating bash scripts. I will personally attest to the value of this reference book. When I'm writing a bash script, this tome is never far away (and usually opened in a PDF reader on another desktop).

There are many other references available on the web. Just perform an internet search for them. If you prefer your reference resource to be in PDF format, just append "pdf" to your search criteria. These six resources should keep you plenty busy and get you off to a good start.


So, I was successful in resurrecting my KDE desktop from the throes of death. Sure, I could have simply reinstalled my KDE desktop from a current Live CD. But then, I'd have to spend a considerable amount of time tailoring KDE to how I like it to be, reinstalling all the programs I use, and getting everything just how I like them to be. Plus, if I re-installed KDE, what would I have learned in the process? Nothing, whatsoever. There's also a feeling of accomplishment when you're able to resurrect a seriously ill system.

While the Linux GUI desktops are very good and typically very stable, you'll do yourself a favor by knowing how to navigate your system and the command line. Fortunately, those skills may not be needed very often, but are priceless when needed.

Previous Page              Top              Next Page
Copyright (c) 2013, The PCLinuxOS Magazine. All Rights Reserved.