This primer is meant to serve as a comparative walk-through for many aspects of Linux. The comparative aspect of this primer takes into consideration that most readers will have a basic familiarity and understanding of Windows 2000 or Windows XP and a desire to learn something challenging, fulfilling, and rewarding.

For every Windows action, there's a comparative Linux action, and with every action, there's an operating system (OS) response. Throughout this document, I'll explore various commands and events that both operating systems share and I’ll show how to invoke simple processes and parallel applications. Because of the distinct individuality of the various Linux distributions (Red Hat Linux, Caldera Open Linux, SuSE, Debian, and Mandrake), this primer will take the liberty of dealing with one particular distribution. Red Hat Linux has risen above all other flavors of Linux to become the most popular and hottest-selling Linux product to date. This is not to play favorites or to say that one distribution is better than the other. Choosing one distribution as a focal point is merely a matter of convenience.

This primer is divided into individual sections: system layout, startup and shutdown, basic file processes, using removable and irremovable drives, the desktop, program installation, system configuration, network configuration, maintenance, basic help systems, and dual booting. Let's begin by examining the system layout.

System layout

The Windows system layout is a fairly straightforward. The C: drive resides on the DOS partition and contains all of the system and non-system folders and files. On the C: drive, you’ll typically find:

  • A set of folders that houses applications (Program Files).
  • Windows general files (Windows).
  • Files and settings users have created or chosen (Documents and Settings).
  • User and application files created in the file tree.

Within the Windows directory, you’ll find the various system folders and files necessary for the basic functionality of Windows. Housed within this same directory (Windows) are the .ini, .bat, .com, and various other files that make up the heart of the Windows operation. It is possible to make the system unbootable, or unstable, by making changes to these files. This problem is somewhat negated in the more recent versions of Windows by having an Administrator and regular users.

The Windows file tree structure shown here doesn’t include all existing files and folders, but it should look familiar (Figures A and B).

Figure A

Prior to Windows NT, the Windows OS was a single-user environment. Windows 9x was configured with one user who uses, administers, and maintains the system. In this configuration, it's very possible for a user to accidentally take the system into an irreversible state. Linux doesn't allow this behavior. Like UNIX, Linux is based on a multiuser environment in that there is an administrator (called root) who is the only user allowed to execute many tasks. Root can do such things as:

  • Add users
  • Delete users
  • Create dial-up accounts
  • Configure networking
  • Install and uninstall programs
  • Make changes to global configurations
  • Access all user accounts

Windows NT, Windows 2000, and Windows XP have added the concept of multiuser systems and the administrator account, thus relieving many of the issues of prior versions.

The user, in Linux, is the everyday user. Users have a limited set of permissions that allow them to execute certain tasks and control only limited environmental variables. It's very easy for a user to break his or her account or desktop. However, if users break, or corrupt, their desktop in Linux, all other users, including root, will still have the use of their own accounts. This design makes for a very safe and secure environment.

The first postinstall task is to have root set up the various user accounts. If you're using the machine as a single-user desktop, simply create a user that will be used for everyday computing. The new user is created in one of two ways: through linuxconf or at the command line. The simplest method is through linuxconf; which is where root can create the new user, give the new user permissions, and add groups to the user. At a prompt (and as root), type linuxconf. Once the linuxconf application has started, scroll down to User Accounts and choose Add. In the Username field, provide a name for your user. Feel free to be creative.

The only other field in this tab that you’ll need to concern yourself with is the Full Name field. Provide the requested information and move to the Privileges section. For safety’s sake, leave the new user’s permissions set to the minimum level. Now activate these changes. Once this user is created, log out of root and log in as the new user. The security of running under user instead of under root is well worth the hassle of having to su to make system changes (more on su later).

At first, this will seem more of an annoyance than a feature. However, the ability to retain global configurations and control all levels of setup, permissions, and customizations while being free to tinker with user accounts will quickly win you over to the multiuser environment. With the multiuser environment, a single controlling unit acts as a sort of overlord to the entire system. Yes, it sounds daunting, but the tasks of setting up devices and altering critical file systems and processes should be left to those with the knowledge of administering a system. If you don’t possess such knowledge, then you won't have to worry about harming your desktop system—it’s as simple as that.

Linux uses the concept of directories, instead of folders. This comes from the character-based roots of Linux. A directory is also a collection of related files and directories. Directories are represented in the Linux GUI as a folder, making the distinction mostly semantic for average users. The administrative user will need to understand the directory concept.

Now that you have a basic understanding of the multiuser structure, let's look at the Linux layout. As mentioned previously, instead of folders, Linux uses directories, and each directory is stored in a mount-point. This mount-point acts as a sort of logical location so that the OS can remember where each file is placed. The main directory for the system is simply /. Yes, it's that simple; / is where it all begins. Housed within / are the following directories: bin, dev, home, /usr/bin, /usr/sbin, var, /boot, and /etc, among others.

Here is a basic listing of what resides in each of these directories:

  • bin: This directory contains the most essential UNIX commands, such as ls, awk, cat, chmod, chown, cp, dd, df, mount, mkdir, rm, rmdir, and touch. These essential commands are the backbone of the Linux/UNIX command environment. The bin directory is, by default, located in the $PATH so that all commands residing within bin are global. (They can be executed from any directory.)
  • dev: This directory holds the files that communicate with the machine’s hardware. This directory contains devices that connect your modem, your CD-ROM, your Ethernet, your floppy drive, and your hard drive to your OS. Almost the entire configuration of these devices is handled during the install.
  • home: Home is literally where the heart is! After you have added your user account, home will contain a subdirectory with that user name. For example, if you added the user Chuck, /home will contain the Chuck directory. The explicit path to Chuck's home directory is /home/Chuck. All of the working directories and configurations are housed within the user’s home directory. Note that a user has no access to the other users' home directories; therefore, each user's configuration is local to only that user. This setup also aids in security. For example, you have a Bob and a Chuck on your system. Bob will not be able to change directory (cd) into /home/chuck, nor will Chuck be able to cd into /home/bob. Likewise, Bob won’t be able to read Chuck's files (as long as Chuck has not set the permissions of his files to global—more on permissions later).
  • /usr/bin: This directory contains other commands, and the difference between /bin and /usr/bin is arbitrary. The split between /bin and /usr/bin was merely a way to divide the vast number of commands local to a UNIX-like system.
  • /usr/sbin: This directory houses commands that are used only by superuser (root). Such commands include netcfg, sndconfig, linuxconf, and netconf. These commands are critical, and improper use can bring a system to a screeching halt.
  • /var: This directory contains most administrative files, including the log files used by various utilities. These log files are invaluable tools if your system develops a problem. All logins and boots are recorded in this directory. One of the most useful of these files is /var/log/messages. Most of these files are accessible only by root.
  • /boot: This directory contains the kernel and other files used during booting. It is crucial that only the well-versed toy with these files.
  • /etc: This directory contains files used by subsystems, such as networking, network file systems (NFS), and mail. This directory also contains tables of networking services and mountable disks.
  • /opt: This is the directory which contains many applications users will use, and install.

This is a simple—not complete—listing. Each distribution adds various directories and files to this basic setup (Table A).

Table A

Windows / Linux
C: / /
Program files / /home/user
System / /usr/sbin and /boot
Start menu / /usr/bin
E: (CD-ROM) / /mnt/cdrom (when mounted)
Control Panel / Linuxconf

This is a simple side-by-side comparison of the Windows and Linux directories.

Again, this is a very minimal comparison, meant only to provide an overview of the comparative structure between Windows and Linux.

In Linux, drives fall under a completely different naming system (Table B).

Table B

Windows / Linux
A: (first floppy drive) / /dev/fd0
B: (second floppy drive) / /dev/fd1
Entire first hard drive / /dev/hda
C: (first HD partition) / /dev/hda1
D: (second HD partition) / /dev/hda2
E: (CD-ROM) / /dev/cdrom

Linux drive names are quite different than their Windows counterparts.

Startup/shutdown

Now that you have a basic understanding of the Linux file structure, let's examine how to start your machine.

Startup

The Linux boot process differs from the very beginning. After the BIOS posts, a Linux native application (named LILO) starts. LILO is a general-purpose boot manager that can boot nearly any type of OS. Typically, LILO will reside on the master boot record (MBR) and will be the first piece of code executed after the BIOS. At the LILO prompt, you can press [Tab] to display the various operating systems available at boot. As previously stated, LILO can boot nearly any type of OS. However, in the case of dual booting between Linux and Windows, the Windows OS must be installed first. (Otherwise, the Windows boot loader will overwrite LILO, and Linux will be unbootable without the aid of a boot disk.)

If your machine is configured to dual boot between operating systems with LILO resting on the MBR, simply press [Tab] at the LILO: prompt, and you'll get a listing of the commands to boot each OS. Typically, the commands are as follows:

  • To boot Linux, either press [Enter], or type linux and then press [Enter].
  • To boot Windows, type dos and press [Enter].

On a properly installed Linux system, the difference in the boot process doesn’t end at the initial load. During the boot process, the various file systems (listed earlier) are mounted, and the boot process stops at either the login prompt or a graphical log in (depending on how you configured the system at installation).

When the boot process stops at login, you'll be greeted with either the login: prompt or the GUI. Regardless of whether it's text or graphical, you’ll provide your username (assuming you've set up a user account) and then your password. If this is your first install and you haven't added a user, you will be required to type (at the login prompt) root, followed by the root password you entered during the last phase of the installation process.

If your machine is configured for text-based login, once you've logged in as user, you'll see another prompt:

[username@localhost username]$

This prompt accepts all the various commands (either essential or nonessential) in Linux. One of these commands is startx, which starts the Linux X Window System. The X Window System is the application that allows the various Linux GUIs to communicate with the OS. The Linux GUI (as a standard Red Hat 6.0 install) has many features found in the Windows 95 environment (Table C).

Table C

Windows / Linux
Taskbar / GNOME panel or fvwm2 taskbar
Start menu / GNOME menu or fvwm2 Start button
Desktop icons / Desktop launchers
Program menu / User menus/Application menus
DOS window / Console terminal
Mouse pointer / Mouse pointer
Copy/Paste / Copy/Paste

Many Linux GUI and Windows features are similar.

Shutdown

The Linux shutdown process is very similar to its Windows counterpart. If the Linux system isn’t shut down properly, the file systems won’t be able to unmount properly, thereby forcing a check during the next boot. This is similar to the event that Windows doesn’t shut down properly and must run ScanDisk. To log out properly, you must go through the main GNOME menu and select Log Out. Once the Log Out option is selected, you will be given another set of options: Log Out, Halt, and Reboot. To shut down the system, choose Halt; to reboot the system, choose Reboot; and to log out, choose Log Out.

Another option included on the Log Out screen is Save Current Setup. It is always wise to select this check box so that your desktop will return to its current state upon logout. In order to log out properly from KDE, select Log Out from the main menu, and you will be returned to the command prompt. To reboot from the command prompt, change to the root user (run the su command by typing su and pressing [Enter]) and then provide the root password when prompted. Once you have root access, you will run one of the following commands:

To reboot:
/sbin/shutdown -r now

To shut down:
/sbin/shutdown -h now

Once the logout process is successfully executed, the OS will begin to unmount the file system and, depending on the option selected, begin the process of shutting down, logging out, or rebooting.

Basic file processes

Now, let's look at the basic tasks of computing. In Linux, there's almost always more than one way to accomplish a task. In this primer, we’ll deal with both the command-line process and the GUI process. Understand, however, that the command-line mode is much simpler and more efficient, but it’s often not as user-friendly. (You actually have to type!) For the sake of this primer, we'll deal with only the basics: reading files, copying files, deleting files and directories, searching for files and directories, changing a file’s permissions, and renaming files.

In Windows, all of these commands are taken care of in a GUI environment. You can perform most of these Windows commands by right-clicking the mouse or using the drag-and-drop operation. To perform the above-mentioned file processes in a console-type Windows environment, the computer must be shut down and restarted in MS-DOS mode. (I purposely do not mention the DOS window due to its inability to function as a true console emulator.) Linux, however, has the power to perform most of these functions in both the console and GUI environments. Why would you want to manage these tasks with the command-line interface when using the GUI is so simple? In console mode, these tasks can take on many arguments and details that the GUI mode (in both operating systems) couldn't possibly handle. Using the command-line interface, you can pipe output to other files (meaning you can take the output from your commands and send it to a file to be analyzed later). You can also move around more quickly and not overwhelm your processor with the load of the GUI. Another benefit to learning the command-line structure is that it allows you to command and control machines remotely. With the help of secure shell (or even the less secure telnet), you can log on to a machine and run commands as if you were sitting in front of that very box.