The magazine of the Melbourne PC User Group

Getting Started and Surviving
Vince Veselosky


Vince Veselosky has spent years using Linux and he leads us gently into the operating system, explaining some of the fundamental differences and how to get help; things we should know before our first experiments with Linux


As you probably already know, Linux is an alternative operating system for your PC. Linux is Free Software, or Open Source, meaning that it is legal to distribute copies, even modify the source code which is published and publicly available. Linux gives you the power of UNIX on a PC budget, and is a very popular platform for running Web and e-mail servers on the Internet. Linux also makes a very powerful desktop operating system for use in homes or offices. This article is meant to pique your interest in Linux and help you get started taking Linux for a test drive.

But... Why?

Why would you want to use Linux, and what can you use it for? Some people choose Linux because it costs less than commercial alternatives, some because they feel access to their operating system's source code is a moral issue or a technical requirement. Many hobbyists use Linux because it allows them to tinker with things that other operating systems lock away beyond normal access.

I use Linux as my normal operating system every day. I browse the Web and send e-mail as normal. I have my entire CD collection ripped and encoded into Ogg Vorbis files on my hard drive, all done with Linux tools. (Ogg Vorbis is an open source competitor to MP3 format and gives better sound at low bit rates, meaning I can squeeze twice as much music onto my 20 GB laptop drive.) I also run a complete Web server development environment on my Linux laptop, including Apache Web server with Perl and PHP modules, an SQL Database (your choice of several, I use MySQL), the GNU Image Manipulation Program (the Gimp) for editing pictures Photoshop-style, and more free HTML editors available than Windows and Mac combined. If there is anything you can't do with Linux, I have not found it yet.

The Linux Problem

For historical reasons Linux is made to be a multiuser system, where users deal only with their day-to-day work, and a system administrator deals with installing, updating, and maintaining the system. The problem is, if you want to explore Linux on your own, you have to gain enough system administrator knowledge to get Linux installed and working properly before you can start using it. This chicken and egg problem is the reason that Linux has a reputation for being hard to install, and has been the focus of much work by the commercial Linux vendors.

The good news is that this is much less of a problem than it once was. Linux installation and setup procedures have been largely automated by the major vendors, so that a competent PC user should be able to install Linux in an afternoon. If you have installed Windows, you will find installing Linux about the same level of difficulty.

Which Linux?

Because Linux is open-source it can be, and in fact is distributed by many different companies. Each company tweaks the software to fit their own idea of what is best, which gives us as the end users a great deal of choice.
 



Figure 1. Near the end of the Mandrake installation, you can reconfigure any settings that may have been detected incorrectly.

Which Linux to get is largely a religious decision. Any of the major distributions will make a usable desktop or server. For Linux beginners, I recommend Mandrake Linux. I believe Mandrake does the best job of simplifying the installation (see Figures 1 and 2) and essential administration tasks for new users, yet it remains powerful enough for advanced users. I use it on a daily basis.



Figure 2. The default desktop after your first login.

Installation Tips

A complete installation tutorial is beyond the scope of this article. Each Linux distribution has its own documentation, and I heartily recommend that you read it before installing. It is also wise to carefully read each screen of the installation before submitting your responses. The install may take a little longer, but will save you time in the long run. However, there are a few things that you will want to know before you start installing.

For one, the Linux Administrator account is called root. During the install, you will be asked to set a root password. That is the password for the administrative account, so make sure you remember it.

You will also be given the opportunity to add users to the system during the install. You should create at least one user, and this should be the regular account you use to log in when you are done. Why? Because when you are root there are no restrictions on your power. You have the ability to crash the system and make it otherwise unusable in more ways than you can imagine. As a novice it is very easy to make your system completely unusable with a single erroneous command. Believe me, I speak from experience. The weekend after I installed Linux for the first time, I had to reinstall it four times before I finally got smart and quit destroying it. And I was a pretty savvy guy around computers even then, so don't think you're immune just because you know your way around a PC. Regular users do not have the unlimited power of root, so you are unlikely to accidentally clobber your system while logged in as a regular user.

Depending on your graphics hardware, you may be asked to configure the X Window System, Linux's graphical user interface (GUI). Most of the time the installer will auto-detect the right settings, but it may ask you whether you want 3D support or other options. The installer may also ask if you want to start X at boot time. Unless you run into problems during configuration, answer Yes. Also, if you get the option to select which desktop environment to use, I recommend KDE. KDE is a very mature and complete desktop environment, and while it does not seek to emulate the look of Windows, most of the Windows functions you are familiar with will be accessible, and you should adapt to the differences quickly.

Important Differences

There is a lot of superficial similarity between DOS and Linux, also between Microsoft Windows and the X Window System. We can leverage the knowledge we already have to get up and running faster in Linux. However, there are some major differences that can trip you up until you get used to them.

Linux is Case Sensitive: To Linux, a capital letter is not the same as a lower case letter. The file Junk.txt is not the same file as junk.txt. Watch this carefully, it could cause you monstrous headaches.

Linux is quiet: When a command succeeds, it will just drop you back at the command prompt without a status message. This can be confusing to new users.

Linux does not confirm anything: In DOS or Windows, if you try to delete a file or folder it will ask for confirmation ("Are you sure you want to do that?"). Linux won't ask, it will just do it. This makes it very easy to accidentally destroy a file, or the entire file system. Be sure of what you type.

Slashes: Linux uses a forward slash (/) wherever DOS would use a backslash (\), that is, as a directory separator. Linux uses a dash (-) to indicate command switches where DOS would use a slash (/).

Search Path: When you type a command, DOS always checks the current directory first, then looks through entries in the PATH environment variable to locate the desired program.

Linux never looks in the current directory; it searches only the directories listed in PATH. To run a program in the current directory you have to type ./ before it. The dot is a shortcut meaning "this directory", as two dots (..) is a shortcut meaning the parent directory.

Getting Help

Once you have Linux installed and running, the most important piece of information you need is how to get help. There are megabytes of documentation right there on your Linux system that can answer all of your questions, if you just know how to access it.

The Help Command

You might expect the command "help" to be the universal way to get assistance, but this isn't true on Linux. The help command is internal to the bash shell, and can only tell you about the shell's internal commands. These include
cd and echo (but not ls), as well as job control commands like bg and jobs. Typing help without any parameters prints a list of things that it can help you with. To get help on a particular command, type help command. For example, to get help on the echo command, type: help echo

man Pages

The standard way to get help, which works on any UNIX system, is a command called
man (think "manual", as in user handbook). To get help on the grep command, for example you would type:

man grep

This displays a help screen describing the program and its usage. Man pages, as they are known, are formatted on the fly from special source files, and are displayed using the program
less. less is a simple display program similar to the more command (less is more, get it?), allowing you to view files that are longer than a single terminal screen, but it allows more liberty in scrolling. You can scroll back and forth line by line with the arrow keys or whole screens using the PgUp and PgDn keys. When you're done reading, press Q to quit (the escape key will not get you out of less) and you'll get back to the command prompt. Man pages are stored in a categorized database. These are the standard categories:

  1. User Commands
  2. System Calls
  3. Subroutines
  4. Devices
  5. File Formats
  6. Games
  7. Miscellaneous
  8. System Administration
Sometimes you will need to know this in order to find the man page you are looking for. For example, there is a user command passwd that can be used to change your login password. If you type
man passwd you will get the man page for this command, since it is in section 1. However, there is also a file called passwd that stores the password database on your system. The format for this file is explained in a man page in section 5, File Formats. To get to it, you need to type man 5 passwd so the man command will look in section 5 rather than starting at section 1.

Man pages are often very detailed and might tell you far more than you wanted to know. If you just want a quick idea of what a command does, use the
whatis command. For example, whatis grep returns:

grep, egrep, fgrep (1) - print lines matching a pattern

This shows you that
grep, and its related commands egrep and fgrep, have man pages in section 1, and are used to "print lines matching a pattern." If you were searching for a command to copy files, you would know this isn't it and you could move on. Or you could consult the man page for details on using these commands.

Related to the
whatis command is apropos, which searches the whatis database for keywords. If you know what you want to do but don't know the command, apropos will give you list of related commands. For example, if you want to copy files, try apropos copy and get:

bcopy (3) - copy byte strings

copy (l) - copy data to/from a class from/to a UNIX file.

copysign (3)- copy sign of a number

cp (1) - copy files

cpio (1) - copy files to and from archives

dd (1) - convert a file while copying it

dvicopy (1)- produce modified copy of DVI file

fcopy (n)- Copy data from one channel to another.


Your list will probably be much longer than this, but by reading through it you will find the command you want is
cp for copying files. If the apropos and whatis commands don't work on your system, it may mean that the whatis database has not been created, or is corrupt. You can rebuild it by running /usr/sbin/makewhatis as root (administrator account). Note that the apropos command will accept only one parameter. You cannot search for multiple keywords. If you try, only the first will be used. The whatis command will accept multiple search words, but searches for them individually rather than as a group (in other words, combining them with OR rather than AND).

info

Many of the utilities included with Linux, especially those created by the GNU Project http://gnu.org, have documentation in the form of info pages. Info pages look similar to man pages, but there is a lot more to them. Like the man pages, info documents are intended to act as your online "manual", your guide to the GNU/Linux system. But info documents are integrated with each other in a hypertext database that can be read like a book (it even has a table of contents) and accessed from your terminal.

Where both man pages and info pages exist, the info documentation is probably more accurate. To get info on the grep command, type:

info grep

The info viewer looks and behaves much like GNU Emacs, a much-respected and much-maligned text editor. Most of the emacs key combinations will work in the info viewer. If you aren't familiar with emacs, you should probably get familiar with it, as its control keys and syntax are inescapably emulated by hundreds of Linux programs.

Navigating info documentation isn't terribly complicated, nor is it completely intuitive. Thankfully, there is a self teaching tutorial included with the package. At any time you can type a question mark (?) or Control-h to access a list of available commands, in case you need help with the navigation keys. Typing "h" by itself takes you to the info tutorial, the first few pages of which should tell you all you need to know for simple operation. The keys to remember are <SPACE> to page forward, <DELETE> to page backward, and <ENTER> to activate a hyperlink. (Links are normally preceded by an asterisk). "L" takes you to the Last node (page) visited, like the Back button in your Web browser.

/usr/doc/*
(or
/usr/share/doc/*)

Many programs are just too complex to store all their help information in a man page. The
/usr/doc directory is where these programs will store their information. Sometimes there will just be a text file, sometimes a program will have an entire subdirectory devoted to it. Also in this folder you may find copies of the Linux How-Tos to help you with common tasks. Take these with a grain of salt. The information in the How-Tos is usually very technical and oriented more toward system administrators than novice users.

Check for a folder named HTML here. If you find it, open up your Web browser of choice and use it to view the documentation. You will feel much more comfortable, I'm sure. I did.

The Linux Documentation Project

The Linux Documentation Project http://tldp.org is your best and most complete source for Linux information. I think hardly a day goes by that I don't visit them for something. Make sure to check their mirror sites for one close to you, to save bandwidth on their server.

Conclusion

Hopefully this article has given you enough information to serve as a survival guide as you begin to explore Linux. We have not even scratched the surface of the things Linux can do once you become comfortable working with it. That's the fun part of using Linux, and I hope that now you can discover a lot more on your own!
 


Table 1 maps some common Windows or DOS commands to their Linux equivalents.
Remember that Linux is case sensitive.


Resources

http://www.mandrakelinux.com
Linux distribution recommended for new users.

http://www.linuxiso.org If you have the bandwidth, this site will help locate a fast mirror to download .iso images and burn your own Linux CDs.

http://www.tldp.org
The Linux Documentation Project is the definitive resource for Linux knowledge of all kinds.

Other Linux Sources

http://www.debian.org
Debian GNU/Linux is a non-profit, community-developed Linux.

http://www.redhat.com
Red Hat Linux is a popular commercial distribution in the USA.

http://www.slackware.com
Slackware Linux is a renowned non-commercial Linux distribution.

http://www.suse.com S.u.S.E. Linux is developed in Germany and is the basis for UnitedLinux products offered worldwide.

http://www.turbolinux.com
TurboLinux is the leading supplier of the Linux operating system in Asia Pacific and is also a member of UnitedLinux.

http://www.unitedlinux.com
UnitedLinux is a worldwide organization of Linux vendors.

About the Author
Vince Veselosky,
vince@control-escape.com is a computing consultant in Atlanta GA USA, helping small businesses leverage Internet and general computing technology inexpensively by using Linux and open source software. He is also an accomplished Perl programmer and Web developer.


Reprinted from the May 2003 issue of PC Update, the magazine of Melbourne PC User Group, Australia

[ About Melbourne PC User Group ]