[Page hit counter] - Back to Linux Links - Back to Site Index

The Linux Learner's Guide

Contributors:

Jem Matzan (jem@thejemreport.com)

Michelle West (evlwmn@thejemreport.com)

Jawad Niazi (foolhardy@thejemreport.com)

The newest version of this document can be found online in HTML format at: http://www.thejemreport.com/linux/guide.htm

version: 1.2

last edited: 05/05/2004

How To Use This Document


The Linux Learner's Guide, or TLLG for short, was designed to make the steep learning curve of GNU/Linux a little less frustrating to endure. This guide is a concise collection of commonly used tricks, tips, commands and programs and will serve to help you learn the basics of GNU/Linux without the sarcasm and derision of asking a frequently asked question on a community message forum or the tediousness of attempting to find the information you need in The Linux Documentation Project (www.tldp.org) and then translating it into understandable terms. GNU/Linux is not difficult to learn if you have the right tools and know where to look for assistance. Best of all, The Linux Learner's Guide is short and easy to understand.

The procedures and tools you can teach yourself can apply to several other forms of open-source operating systems. We hope that you will find this document to be a superb supplement to your knowledge no matter where you are in your involvement within the rapidly developing world of alternative operating systems. What this document is not is a step-by-step walkthrough or an instruction manual. Our goal is to help you help yourself – the old proverb of teaching a man how to fish.

The layout of TLLG is simple: there are normal chapter headings like in a real book, along with a table of contents to help guide you to the proper section. While we recommend reading the entire document from start to finish, it is also very possible to use this guide as a reference “only when you need it.”

Commands that you type in are highlighted. So if it says to type in cdrecord -scanbus then you would type in the highlighted words and hit enter. Follow the capitalization and punctuation exactly – Linux is very specific about that. If you do not type in the exact highlighted words you will not get the desired results. There is also a part of this document where we quote a configuration file to show you the proper section to change. The text in the configuration file is in red to better distinguish it from the normal document text.

If you have questions that are not covered here there are several avenues available for help. If you’ve purchased a retail box distribution such as Mandrake, SuSE or Red Hat, the distribution company is obligated to provide you with installation support and a way to interact with the community either through message forums or email lists. Please attempt to solve the problem on your own (either by reading this guide in its entirety or by reading TLDP or the manual or documentation that comes with your distribution) before posting a question to the community. If you don’t know where to go for help, try the forums at one of these addresses:


www.thejemreport.com/community/

www.8dimensional.com/forums/


These are just a few of the friendly places on the Internet where any inquiries in English can be made with regard to the software discussed in this document. The communities are young, vibrant, and most of all, extremely helpful in helping you find a solution to your problems.

Table Of Contents


  1. Linux defined

    1. Distributions

    2. The GNU project

    3. The levels of Linux

    4. The Linux kernel

      1. Editing and compiling the Kernel

      2. Finding modules for your hardware

      3. Installing modules

    5. The GNU/Linux file structure

  1. The shell

    1. Navigating the command line interface (CLI)

    2. A list of commonly used commands

    3. A list of common configuration files and their uses

    4. Shell scripting

  1. XFree86 -- the gateway to the graphical interface

    1. The xf86config utility

    2. The XF86Config file

    3. Starting X

  1. Programs and software

    1. Desktop environments

    2. Window managers

    3. ALSA and sound configuration

    4. Gzip and tar

    5. Commonly used Linux programs

    6. How to find new software

    7. Installing software

      1. Installing from source code

      2. Guide to Gentoo Linux ebuild installation

      3. Guide to Red Hat Linux RPM package installation

      4. Guide to the Debian Linux DEB package installation

  1. Useful websites and resources

-I-

Linux Defined


GNU/Linux is a UNIX-like operating system invented jointly yet independently by Richard Stallman (who started the GNU project) and programmer Linus Torvalds (who designed the Linux kernel). Linux is only a kernel (described below) but when we generally discuss Linux we are often referring to a Linux distribution. The term distribution includes the kernel, the GNU operating system that uses the kernel, and sometimes some other programs and software like desktop environments, email clients, word processors, etc. that are bundled with the distribution.


-I.1-

Distributions


GNU/Linux distributions (or distros, for short) come in over one hundred different varieties and feature various tools like graphical install utilities, software package management, customized desktop environments, proprietary kernel code, and kernel management programs.

Most distros are based on one of two core distributions: Red Hat and Debian. There is a third category of GNU/Linux distribution which compiles itself and its programs from source code; these are generally referred to as source-based distributions. Before you proceed you should make an effort to determine which of these your distro is based on; one way to tell is to look in the documentation to see what sort of package management system it uses. If it uses RPM (Red Hat Package Management) then it’s Red Hat-based. If it uses DEB (Debian package management) then it’s Debian-based. If you’re using Slackware you can type pkgtool in the command console and get to the package management tool. If you’re using a source-based distro... well, usually you will be well aware of that before you even download it. Source-based distros are specific to each individual distribution. For more information on GNU/Linux distributions, visit this site:


www.distrowatch.com


Some distributions are split from a larger project and include many of the same features as their originating projects; these are referred to as fork distros.


-I.2-

The GNU Project


GNU stands for “GNU’s Not Unix,” which means that while a GNU-based operating system is designed to look and operate like Unix, it is not truly an identical copy of it. The GNU Project was started by Richard Stallman in 1984 and through the efforts of many fine software developers it grew into what it is today.

In 1991 Linus Torvalds finished the Linux kernel; when it was combined with the GNU Project it formed a complete operating system known as GNU/Linux. Other kernels have been used in conjunction with the GNU Project, like the Mach kernel and the Hurd kernel, but Linux is the most popular. In general, GNU/Linux is what most people mean when they talk about Linux.


-I.3-

The Levels Of Linux


Generally speaking, these are the levels of GNU/Linux, starting from the bottom:

The Kernel: the basic instruction set for nearly every low level aspect of the machine. It contains/can contain the instructions necessary for the hardware to run (in other words, it’s a low level hardware interface), resource allocation and security. It decides who can log into the system and what permissions they have, based on how the kernel was compiled. The kernel is the most basic level of the OS but is more or less useless without libraries, shells and other important programs from the GNU Project.

The Shell: software that interfaces with the kernel code and all software installed on the machine. This interface can be at a very low level or a very high level depending on the level of privilege the user is given. This idea is termed “user permissions” and is reflected by the amount of control the user currently logged into the system actually has. This can be counter-intuitive so be careful! The more control a user is allowed (hence more permissions) the lower the level of interfacing (the shell) between the kernel and the machine. A low level shell open to a user indicates a high degree of privilege assigned to that user, and therefore more overall control allowed. You type commands in a human language into the shell and the shell passes the instructions to the kernel in machine language. The shell is not part of the kernel; it is a command language interpreter that uses the kernel to execute programs, create/delete/edit files and change settings on the machine. Examples of shells are BASH, TCSH, CSH etc. Most GNU/Linux distros use BASH by default.

X Window System: (sometimes called an X Server) an application that rides on top of the shell that allows X Clients (programs that require the X Server) and a desktop environment or window manager (GUI) to run.

Desktop Environments and Window Managers: graphical user interfaces that allow you to run graphical software, manage files, and perform shell commands through the interface. In other words it provides icons, menus, etc. that will in turn perform shell commands. It also provides a high-resolution workspace from which you can play graphic-intensive 3D games, use graphical web browsers, and any other software that requires high resolution and color depth. KDE, GNOME, and XFCE are examples of desktop environments. There are distinctions between desktop environments and window managers: a window manager is a little “thinner” than a desktop environment; it does not have a desktop, icons, or specialized software modules to control system functions like a desktop environment does. Instead a window manager uses a simple menu system to run shell commands. You can use a window manager in conjunction with a desktop environment to provide a desktop for icons, etc. Some examples of window managers are Fluxbox, Enlightenment, and IceWM.







-I.4-

The Linux Kernel


The Linux kernel comes in many different varieties. To begin with there are different versions. The most common versions these days are derivative of the 2.4 kernel, although as of this writing the 2.6 kernel is scheduled to be included with the next major release of nearly every distribution, and is included in many current distros already. We recommend using the 2.6 kernel if at all possible, due to the expanded hardware support, better performance and the fact that it is much easier to build, configure and use.

A simple naming scheme is set up to help determine what kind of kernel you may be using: even numbers delineate “Stable” or well-tested kernel versions, and odd numbers delineate “unstable” or development kernel versions. The 2.7 kernel, for instance, is the development kernel that will attempt to introduce major revisions and technological features to the 2.6 kernel. When it’s complete it will be renamed 2.8 and be released as “stable” after sufficient testing.

If a kernel needs specific support for a kind of hardware, or if a security flaw or bug is discovered, a “patch” is released to fix it. Each major patch increments the kernel version's number, so you'll always want the highest number in the “Stable” series that you can get. For example the 2.4.23 kernel is a better choice than the 2.4.18 kernel.

Within the versions there are different flavors of the Linux kernel. The standard (or stock) kernels are known as the Vanilla Sources. This is the “safe” kernel with all of the customary modules, settings, and options. The Multimedia Sources (“mm-sources”) kernel is optimized for multimedia and the Gaming Sources kernel is optimized for 3D gaming. Beyond that, every major distribution has its own custom kernel, tailored for it's own goals and user market. Gentoo has Gentoo Sources, Red Hat has Red Hat Sources, and individual developers also have their own personal version of the kernel that they sometimes make public, for example Alan Cox has AC-Sources.

How will you know which one to choose? Vanilla Sources or the kernel that comes with your distribution is a good kernel to start with. When you become more proficient in the use and configuration of GNU/Linux then you might get some enjoyment out of experimenting with other kernels. One of the beauties of using GNU/Linux is that you can change kernels without changing anything else in your operating system other than updating some of the configuration files!


-I.4.1-

Editing and Compiling the Kernel


If you ever find yourself in the position where you need to make custom changes to the kernel – adding functionality for a certain piece of new hardware or taking out unnecessary options to make your computer startup faster – there are a few basic things you need to know.

First of all, your kernel source code is usually located in the /usr/src directory, although some distributions don't install the kernel source by default. If that's the case, you'll have to visit the distribution's website to get the kernel source. Alternatively you can visit this website to get the source code for the Vanilla kernel:


www.kernel.org


Once it's downloaded, follow the procedure in section IV.7.1 to unzip, untar, and install the source code. Having the source code on your computer allows you to make the changes you want in the kernel and then rebuild it (compile it) into your operating system. The rest of this section is intended for those who already have the kernel source in /usr/src/

To change directories, type in cd /usr/src and hit enter. There should be at least two subdirectories therein; one will be where the code is stored and the other will be a symbolic link (an alias for or shortcut to the real directory). The symlink is /usr/src/linux and the actual kernel directory depends on which kernel you have installed. By typing in cd linux you’ll be putting yourself in the Linux source code directory. The symlink automatically brings you to the directory it is linked with. It is not a separate directory; it’s a shortcut to another directory.

If you want to see what’s in your kernel right now, log in as the root user or use the su command to get root permissions and, having already entered the /linux directory, type in make menuconfig and hit enter. A graphical menu will come up with all of the options for the kernel. Use the arrow keys, space bar, and esc key to move around in it. Most commercial distributions have fairly large kernels with most (or all) of the options already selected and installed (or built as external kernel modules which are loaded when needed). This is good because it can accommodate almost any hardware you throw at it; on the other hand, more kernel options means a longer boot time and a larger kernel. If a fast boot time isn't terribly important to you then you should leave everything alone. If you know what hardware you have and are going to use, you can experiment with disabling some of the kernel options.

If you’re going to be installing a new kernel from scratch – for instance if you wanted to switch from the 2.4.21 kernel to the 2.4.23 kernel, you have to take an extra step before you go into the kernel menu. Type in make mrproper and hit enter. This will reset your kernel options to their defaults and clean out old files from important directories. The kernel will attempt to figure out what hardware you have and select the proper modules. It’s not always right, although each new version of the kernel gets much better at properly autodetecting hardware. Now type in make menuconfig and you can go into the kernel menu.

If you want to switch from the 2.4 kernel to the 2.6 kernel, you can run into a lot of snags, especially with RPM-based distributions like Red Hat. There is an excellent resource for performing this migration at this address:


http://kerneltrap.org/node/view/799


You’ll notice that there are two ways of installing an option in the kernel: you can build it as a module (denoted by an [M] to the left of the option) or build it directly into the kernel (denoted by a [*] to the left of the option). There are some options that must be built into the kernel, like support for some kinds of file systems, but for the most part you have a choice as to how you would like to build the kernel. Some experts recommend installing most things as modules because it’s easier to update or remove them if necessary. If you build something into the kernel you cannot remove it without rebuilding the kernel and rebooting the system. We recommend building everything into the kernel at first; the possible exceptions are your video and sound drivers, which you may have to obtain patches or modules for anyway. Once you become more experienced with using the Linux kernel you might find that building most options as external modules will be better suited for your situation.

When you’re done configuring the kernel it might be a good idea to save the configuration in case you need to build the kernel again in the future. The last option in the kernel menu is the option to save the configuration to a file. Type in a location and a name like /usr/src/backup and hit enter. This saves the configuration as a file called “backup” in the /usr/src/ directory.

Exit the kernel menu (it’ll ask you if you want to save the kernel configuration before you exit; the answer is yes) and usually the menu will tell you what to type in. If you’re using a 2.4 kernel, you’ll want to type in:


make dep && make clean bzImage modules modules_install


and hit enter. If you've got a 2.6 kernel the command is:


make bzImage && make modules && make modules_install


This will clean up the kernel directories and prepare them for a new kernel. Then the kernel will be built and all of the modules (if there are any) will be installed to the proper directories. Depending on the speed of your computer and how large you’ve made the kernel, the compile time can be anywhere from five minutes to an hour. The “&&” symbols represent stacked commands. In other words, you'll be running a number of commands in succession, but you're typing them all in at once and in one line to make things easier and faster. The && means, “and then execute the following command.”

When the kernel is done compiling, type in cd arch/i386/boot and hit enter (assuming you’re using an Intel, Cyrix, or AMD-based system with a standard 32-bit processor anywhere from a 386 to a Pentium4 or Athlon XP. If you’re using a different architecture like sparc or amd64, substitute that for i386). And there in that directory is your new kernel, which will be named bzImage. Now you’ll need to copy it to your /boot directory. Most people don’t have their /boot directory mounted at boot time, so in all likelihood you’ll have to mount it. To do that, type in mount -a and hit enter. This will mount all of the partitions defined in your /etc/fstab file, which we’ll discuss later.

Now type in cp bzImage /boot and hit enter. This copies the new kernel to the /boot directory.

If you’re using LILO for your boot loader (the other choice would be GRUB) then you’ll need to type in /sbin/lilo and hit enter. This re-initializes LILO for the new kernel. If you’re using GRUB, you don’t have to do anything.

Restart the system (to do that from the command line, type in reboot -n and hit enter or press ctrl-alt-del) and when the system boots up again you’ll be using your new kernel.


-I.4.2-

Finding Modules for Your Hardware


This section can be somewhat intimidating because it deals with special-case situations in which you’ll have to go chasing down a driver. This process isn’t that much different than it is in Windows, and in most cases the kernel will autodetect your driver for you and you won’t have to deal with this. But read on, just in case.

Sometimes it’s not as simple as just selecting a kernel option; sometimes you need a module for hardware that isn’t listed. All is not lost; you simply must find the proper module and install it. Sounds easy – and it is, if you know what to do.

First you’ll have to identify your hardware. Who makes it? What model is it? In most cases this information is fairly easy to obtain, especially with PCI or AGP cards. The real difficulty comes into play with onboard peripherals like sound, video and LAN. Here is a brief outline of the brands of onboard sound chips that modern motherboards use:


Realtek

Analog Devices

nForce SoundStorm (rare)

SiS (rare)

ESS (laptops, primarily)

Yamaha (rare)


Onboard video processors:


Intel Extreme

Intel Extreme 2

SiS

Nvidia GeForce 2 MX

Nvidia GeForce 4 MX


Onboard LAN is one of these brands:


Realtek

Broadcom

Intel

SiS


So how do you find out which ones your board is using? The motherboard manual will usually tell you in the specification listing near the beginning. If not, try the manufacturer’s website. If you still can’t find out who makes your onboard sound, LAN or video chip, there are two more things you can try:

If the motherboard uses an Nvidia chipset, it’s sure to be both Nvidia sound and video onboard. If the chipset is the nForce 220 or 440, your video is the GeForce 2 MX and the sound is Soundstorm. If you’re using the nForce2 you’ve got a GeForce 4 MX and Soundstorm sound.

If you’re using an Intel brand motherboard, the video is Intel Extreme. If the northbridge chipset is the 865G or better, you’ve got Intel Extreme 2 graphics. The sound on most Intel brand boards is usually Analog Devices. If you’re using a motherboard made by a different company like Asus, MSI, Iwill or any of the others, the sound is usually Realtek, as is the LAN (but not always). Motherboards that use SiS video are fairly rare, but if you have a SiS-based motherboard (the northbridge is made by SiS) then you’ve got SiS video and usually SiS sound and LAN as well. Once again, all of this information can be found in your motherboard manual or on the manufacturer’s website.

To find out which module your hardware will use, you'll have to look through the choices in the kernel menu and press ? to see which chips each module will support. In some cases you may have to visit the manufacturer's website to obtain a Linux driver module.


-I.4.3-

Installing Modules


Once you know what special module you need, installing it into the kernel is easy – simply select the option in the kernel menu, save, exit, and compile as listed above.

But if you want it done more quickly, you can install the module only. If you had to download a driver from a website, the only way to install it is as a module.

There are three basic commands that you need to know in order to deal with kernel modules: lsmod, insmod, and modprobe. lsmod lists all of the currently installed modules; insmod will install a module; and modprobe, which is like insmod only more powerful. In all likelihood the only command you’ll need to use is modprobe.

When you’ve downloaded and unzipped the driver module, simply switch to the directory you unzipped it to and type in:


modprobe <module>


where <module> is the name of the module. So if I wanted to install the module for an Nvidia-based video card using the driver provided by Nvidia, I’d type in:


modprobe nvidia


The next step is to load the module at startup. While it’s possible to modprobe the module every time you boot the system, it’s easier to add the name of the module to the /etc/modules.autoload configuration file.

First make sure you’re logged in as root, or type in su to switch to superuser mode upon giving the password. Then use your favorite editor (usually nano, vi, or ee) to edit the /etc/modules.autoload file and just type in the name of the module on a blank line. There is no limit to the number of modules you can put in, but they must all be on separate lines.


-I.5-

The GNU/Linux File Structure


The UNIX directory structure, which applies to Unix, BSD, GNU/Linux and all other *NIX operating systems, is rather archaic but based on the POSIX specification and conforms to one standard that all such operating systems use. Here is a brief description of the directory structure that is generally used by most GNU/Linux distributions:


/ (the root directory; the parent directory for all other directories)

/opt (where program files for 3rd party programs are kept)

/etc (where most configuration files are kept)

/bin (essential command binaries/executables)

/sbin (essential system binaries/executables)

/tmp (temporary files)

/lib (shared libraries and kernel modules)

/dev (device nodes for your hardware and peripherals)

/home (where program config files, settings, and personal data is stored for each user)

/root (root's home directory)

/boot (where the boot files, such as GRUB and the compiled kernel, are kept)

/mnt (symlinks to mounted drives in /dev)

/var (system logs and variable data)

/usr (global system/program files)


Generally a user account does not have write permissions to any of these directories except the user’s home directory. The root account has full access to all directories, however the /boot dir is not generally mounted by default in most distros. To access the /boot directory you may have to specifically mount it by using the mount command.

-II-

The Shell


Most GNU/Linux distributions use BASH (Born Again SHell) as the default shell, but there are several more that you may come across in your *NIX travels; TCSH and CSH are two examples of other shells.

As mentioned earlier, the shell is the way we interface with the operating system. You type in commands and the system (hopefully) complies – that's really all there is to say about it.


-II.1-

Navigating the Command Line Interface (CLI)


Files are stored in directories according to their nature and purpose. Using the command line interface is inevitable if you’re going to use GNU/Linux or any other *NIX system. While you don’t usually need to go to the CLI often or for very long, knowing how to use it is very important. This is how you have access to the shell and important system functions as far as your logged user privileges/permissions allow.

Finding your way around the CLI means thinking in different terms, if you’re used to a graphical file manager. Hopefully the directory structure above and the command reference below can be of some assistance when learning your way around. Here are the basic navigational functions:

To change directories, type in cd and then the directory as in this example:


cd usr


This assumes you’re in the root directory or that you’re trying to go to a subdirectory within the one you’re in. If you need to change directories from one to another, for instance from /usr/src to /lib, then you need to put a slash before the destination directory as in the following example:


cd /lib


To list files in the directory, type ls. To find a file or a directory, type whereis and then the filename. To copy, the command is cp, and to delete the command is rm. With this basic knowledge you can begin to learn to navigate the command line interface.


-II.2-

A list of commonly used commands


There are a lot of commands in the shell, but chances are you’ll never use most of them. Beyond that, each command has a number of switches and options that can be used to change its functionality. To find out what they are and how to use the command, follow the command with a -help or -? or precede the command with man. So if you wanted to find out what all of the options are for the command cdrecord you would type one of the following:


man cdrecord

cdrecord -help

cdrecord -?


You can also use the manual in the KDE Help section, which can be found in the K menu.

Below is only a listing of the most commonly used CLI commands and what they do. Refer to this partial list only when you’re looking for the right command for the right job -- do not indiscriminately execute commands in this list, as you can easily harm the operating system by doing so. Remember, if you only know the first few letters of a command or directory, you can always use the Tab key to complete terms for you.


cd (changes directory)

chroot (changes the root directory)

chmod (changes file permissions)

chown (changes the ownership of the file from one user to another)

configure (makes configuration file for compiling from source)

cp (command for copying files from one place to another)

dmesg (displays kernel messages from startup)

emacs (GNU text editor, installed by default on many distros)

exit (exits Super User mode, can also close the terminal)

grep (searches files for a given string)

ls (lists all files in dir)

less (types a text file on the screen)

mount (mounts a disk or CD and associates it with a directory)

netstat (displays network status)

depmod (rebuilds kernel module tables)

kerneld (manage kernel modules)

rm (deletes files)

df (list disk free space)

fromdos (convert DOS files to Linux files)

fdisk (partition utility)

fsck (file system check)

halt (alternative shutdown now command)

hdparm (hard drive adjustment utility)

insmod (install module)

lsmod (list modules)

lprm (removes print job from the print spool)

ldconfig (reloads the system path)

make (compiles a program using the configure settings)

make install (installs necessary components into proper dirs)

make mrproper (clears all kernel settings and configurations)

make menuconfig (graphical menu for kernel configuration)

mke2fs (EXT2 filesystem format)

mke2fs -j (EXT3 filesystem format)

mkreiserfs (ReiserFS filesystem format)

mkisofs (creates an ISO image)

mkxfs (XFS filesystem format)

|more (when typed after a command, pauses terminal output after each screen)

mkdosfs (make a FAT16 file system)

modprobe (query module)

mv (move)

mkdir (make directory)

nano (a simple text editor that some distros install by default)

pico (text editor much like nano, installed by default on some distros)

reboot (reboots the computer)

rm (removes a file)

rmdir (removes an empty directory)

rmmod (removes module)

swapon (sets swap partition)

shutdown (shuts down the computer)

strace (trace system calls)

su (superuser/root/admin mode)

startx (launches X window system)

xload (display system load info)

xkill (ends a process)

vi (a complex text editor that most distros have)

whereis (finds files)

who and rwho (lists information for current users)


-II.3-

A list of common configuration files and their uses


Here's a list of the most common configuration files that you'll be working with in GNU/Linux:


/etc/fstab (defines file systems and mount points for drives)

/etc/X11/XF86Config (XFree86 configuration file)

/etc/X11/XF86Config-4 (same as above, just a different name)

/etc/lilo.conf (if you use LILO, this is your configuration file)

/boot/grub/grub.conf (if you use GRUB, this is your config file)

/etc/make.conf (specifies switches and flags for compiling programs)

/etc/modules.d/alsa (ALSA sound configuration file)

/etc/inetd (configures things like finger, telnet, ftp, etc.)

/etc/resolv.conf (configures the local domain name and your DNS server IPs for your ISP)

/etc/rc.conf (specifies and configures startup scripts)

/etc/host (sets the domain name and local host address for your system)

/etc/syslog.conf (configures the system event logger)

/etc/wvdial.conf (dialup ISP settings if you use dialup Internet access and if you are using wvdial to connect)


-II.4-

Shell scripting


A shell script is a text file with a list of CLI commands to be performed in order. If you're familiar with DOS, this is much like a batch file. Creating a shell script is easy; simply open a text editor and type in the commands that you want the script to execute, then save and exit the editor. Next, give it executable permissions by typing this in:


chmod +x yourscriptname


where yourscriptname is the name of your script. Alternately you can use this command (both do the same thing):


chmod 755 yourscriptname


There is, of course, much more to it than this, but shell scripting is not something that you have to learn. It is, however, something that you should be aware of because it's likely that you'll have to edit a shell script at some point in your GNU/Linux adventures.


-III-

XFree86 -- the gateway to the graphical interface


The command line interface is very powerful in terms of what you can do through it, but most people prefer a more graphical interface. To use a desktop environment or window manager like we mentioned above, you will first need to run an X Window System server. The one included with most GNU/Linux distributions is called XFree86. This is a program that acts as a graphical shell that works on top of the command line interface. The X Window System is far from perfect but is adequate when paired with popular video cards (for example, those with Nvidia chipsets) and updated several times a year for compatibility with new displays and GPUs.

If you'd like to find out more about the X Window System, follow this link:


www.x11.org


And to find out more about XFree86, go here:


www.xfree.org


-III.1-

The xf86config utility


Before you can use XFree86, you'll have to properly configure it for your system. There are a few different methods for configuring the X server, but the most reliable method is by using a program called xf86config Running this program is simple; as root, simply type in:


xf86config


from any directory and the utility will run.

The program is text-based and will ask you multiple-choice questions about your hardware, such as the type of mouse and keyboard you use. If you don't know what device node your mouse is on, just use the default for now. We'll get into troubleshooting X a little later.

Choosing your monitor's refresh rate can be somewhat confusing, since most of us don't know exactly what the settings should be. On many modern monitors you can hit a setup button (usually on the front of the monitor) and it will tell you some or all of the refresh rates that you need to know. Your monitor's manual or the manufacturer's website may also reveal the refresh rates. If in doubt, choose 31.5-48.5 for the horizontal refresh and 50-70 for the vertical refresh.

The video driver is tricky; the only ones included with XFree86 are generic drivers that don't allow for hardware acceleration. This isn't a problem if you aren't doing 3D rendering or don't need OpenGL for anything, but if you do then you'll need to get a different driver. For now just select a generic driver that fits your video card's description (nv for Nvidia cards, radeon for ATI Radeon cards, etc.).

After the program is complete, try to start X as outlined below.

Alternately you can let the system try to guess the correct settings for you. Usually this works well, but sometimes it doesn't, so we don't recommend this way by default. The command is XFree86 -configure and when it's done it will copy the new configuration file to /root/XF86config.new. You must copy this file to

/etc/X11/XF86Config in order for XFree86 to start properly.


-III.2-

The XF86Config file


The settings that you just saved by running the xf86config program are stored in the XF86Config file, which can be found in the /etc/X11/ directory. Remember: file names and directories are case-sensitive, so make sure you capitalize the right letters.

-III.3-

Starting X


There are many ways to start the X Window System. The basic startup scripts that come standard with XFree86 are startx and xdm and all you need to do is type one of those commands in and hit enter and the X server will start with the default window manager. If you have other window managers installed (such as Fluxbox or Blackbox), you'll want to run xinit instead. This script will start the X Window System without running the default window manager. It gives you a prompt where you'll type in the name of the window manager you want to run; so if you want to run Fluxbox for instance, you'd type in:


xinit


and then at the prompt, type:


fluxbox


If you're using KDE you can use a much nicer startup script by typing kdm and hitting enter. GNOME has a similar script called gdm Please refer to the help files in KDE or GNOME if you wish to customize these startup scripts.

If X refuses to start, the usual suspects are the video and mouse settings. The XF86Config file is very easy to navigate and understand. If you can't start X, you can try changing some of the settings in this file or you can simply re-run the xf86config utility and choose different options than before.

If your mouse does not work in X, or if it behaves erratically, you've specified the wrong device node for the mouse. If you're using a PS/2 mouse connected to the PS/2 port, try using this device node instead:


/dev/mouse


And if you're using a USB mouse, use this node:


/dev/input/mice


So in your /etc/X11/XF86Config file you'll want the Core Pointer section to look something like this:


# *******************************************************************

# Core Pointer's InputDevice section

# *******************************************************************


Section “InputDevice”


# Identifier and driver


Identifier “Mouse1”

Driver "mouse"

Option “Protocol” “ps/2”

Option “Device” “/dev/mouse”


If you change the Device setting to /dev/input/mice and your USB mouse still doesn't work, you may have to change other settings. For more information on configuring a USB mouse, visit this address:


www.linux-usb.org/USB-guide/x194.html


If your mouse wheel does not work, there are two simple lines that you'll have to manually add to the /etc/X11/XF86Config file in the Core Pointer section as outlined above:


Option “Buttons” “5”

Option “ZAxisMapping” “4 5”


This sets the mouse's fourth and fifth buttons to scroll up and down (the mouse treats each wheel direction as a button). If you have a mouse with more buttons than usual, you may have to change the numbers:


Option “Buttons” “7”

Option “ZAxisMapping” “6 7”


You can insert these lines anywhere after the Device line in the Core Pointer section. Please note lines that start with “#” are called “commented lines” which means they won't be run. So if the lines above are already there and you want them loaded, just uncomment them (remove the #).

If you need 3D hardware acceleration and have a video card capable of doing OpenGL (any AGP card should be able to do OpenGL), you'll need a special driver for X. Nvidia provides Linux drivers for their cards at this address:


www.nvidia.com/content/drivers/drivers.asp


And ATI provides Linux drivers at this address:


www.ati.com/support/driver.html


If you're not using an ATI or an Nvidia card, you'll have to use the Direct Rendering Infrastructure (DRI). For instructions on DRI, visit their site at this address:


http://dri.sourceforge.net


-IV-

Programs and software


Using GNU/Linux is all about supporting Free Software. There are, however, several proprietary or otherwise restricted software programs, plugins and components available for GNU/Linux. Whether you should use them or not is up to you, but if you'd like more information on Free Software and why it is the ethical choice for your computing needs, please visit:


www.fsf.org


There are two main websites that act as repositories for most of the world's Free Software projects. They are:


www.sourceforge.net

www.freshmeat.net


If you're looking for new programs or just want to browse the software database, visit the above addresses.


-IV.1-

Desktop Environments


There are two primary desktop environments in the GNU/Linux world: the K Desktop Environment (KDE) and the GNU Network Object Model Environment (GNOME). Most people agree that KDE is somewhat like Microsoft Windows and GNOME is somewhat like MacOS in terms of their look and feel. Both environments support large numbers of excellent programs; chances are, you'll need at least one GNOME library to install nearly any program in the GNU/Linux world.

We've found that it helps to install GNOME whether or not you plan on using it; programs that have a GNOME library dependency tend to want older versions of the libraries than are currently available. So when you want to update your system, it can be a dependency nightmare as different programs struggle with different versions of the libraries they need; by installing GNOME in its entirety first, you're locking the library versions together into one package, making it easier to upgrade and less prone to breakage.

If you're building a small-footprint system for a web server or other special use, you may only want to install what you absolutely need to run the system. In these cases it may be wise to let the programs determine their own dependencies rather than install all of GNOME as mentioned above. This is really a matter of personal choice and preference.

Desktop environments are very easy to use, include a menu system and a desktop space for storing icons and files, and generally have programs that can modify or adjust your hardware configuration. A desktop environment is a jack-of-all-trades, including most everything you'll need to operate your computer. If you're in an office or other production environment or if you're just starting out with GNU/Linux, we recommend using KDE or GNOME at first. There are other desktop managers such as CDE and XFCE that you may want to experiment with. For a complete listing, see the link in section IV.2 below.


-IV.2-

Window Mangers


A window manager is a graphical skin for the X Window System that allows you to easily run and manage programs. Generally you'll be starting programs from a command line window or from a built-in menu system (or both). Window managers do not intrinsically have a desktop to store icons or files on or a control panel or other configuration utility to modify your hardware options.

So what are the advantages to a window manager? It's thinner (takes up less hard drive space), uses less resources, is more customizable and starts more quickly. On the other hand they are much more difficult to configure and not quite as intuitive as a desktop environment.

Some popular window managers are Fluxbox, Blackbox, Enlightenment, WindowMaker, and IceWM. For a full listing of window managers and desktop environments for the X Window System, visit this address:


http://xwinman.org


-IV.3-

ALSA and Sound Configuration


ALSA stands for Advanced Linux Sound Architecture and it is the software that allows your soundcard to communicate with your operating system.

The 2.6 kernel has integrated ALSA support for pretty much every kind of consumer-grade soundcard and onboard sound chip on the market. If you need a special ALSA driver, visit the ALSA website:


www.alsa-project.org


For the 2.4 kernel, it's possible that you'll have to download the ALSA driver for your particular sound card. Visit the website above and follow the instructions for downloading and installing the driver for your card. Remember to use a mixer utility to unmute the output channels after the driver is properly installed!

There's another sound driver called OSS, and it stands for Open Sound System. Despite its name, it is a company that makes proprietary sound drivers for Unix operating systems and they charge a ridiculous amount of money for it. Some of the more obscure OSS drivers are offered for free in the Linux kernel, but most of what OSS offers is neither free as in rights, nor free of charge, and they don't actually sound that great. Probably as a result of its non-open and non-free status, OSS has been deprecated in the 2.6 kernel. Steer clear of OSS!


-IV.4-

Gzip and Tar


There are many ways to compress and package a file or group of files. The most common method of packaging files in GNU/Linux is by using the tar utility. Tarred files (also referred to as “tarballs”) have a .tar extension and can be unpackaged with the following command:


tar xvf filename.tar (where filename.tar is the name of the tar file)


Sometimes tarballs are also compressed. Usually the Gzip program is used to compress them, but sometimes it's Bzip or Bzip2. The commands for decompression are the same for all three compression utilities:


gzip -d filename.gz

bzip -d filename.bz

bzip2 -d filename.bz2


Gzip files have an extension of .gz, Bzip and Bzip2 are .bz and .bz2 respectively. So if you have a file called filename.tar.gz, you can unpack the files from this archive by typing the following commands in sequence:


gzip -d filename.tar.gz

tar xvf filename.tar


When you uncompress a Gzipped file it will not leave the compressed file behind, so uncompressing filename.tar.gz leaves you only with filename.tar, not that plus the old filename.tar.gz.


-IV.5-

Commonly Used GNU/Linux Programs


Below is a partial listing of commonly used Free Software along with a short description of each program's purpose:


Abiword (relatively simple GTK-based word processor, can use doc files)

OpenOffice.org (suite of office programs comparable to Microsoft Office)

TextMaker (outstanding standalone word processor, non-free)

Ximian Evolution (email and PIM much like Microsoft Outlook)

XMMS (WinAmp clone, used for MP3s and other multimedia)

Ogle (command line DVD player, also has a GUI add-on)

cdrecord (part of the cdrtools program package, cdrecord writes CDs from the command line; many different GUI clients are available for this utility)

Opera (an excellent web browser, non-free)

Mozilla (free web browser and email client based on the Netscape code)

The GIMP (an image manipulation and drawing program)

GFTP (GUI-based FTP program)

Bluefish (excellent webpage editor, supports HTML, CSS, PHP and more)

NetSaint (system monitor)

GAIM (instant messaging utility supporting many networks; much like AOLIM)

Grip (CD ripping utility)

GNU Cash (accounting software similar to Intuit Quicken)

GNUmeric (GTK Microsoft Excel spreadsheet clone, usually paired w/Abiword)

Ximian RedCarpet (graphical software package manager)


Games:


Wolfenstein: Enemy Territory (FPS)

Unreal Tournament 2003 (FPS, non-free)

Unreal Tournament 2004 (FPS, non-free)

Quake3 Arena (FPS, non-free)

Neverwinter Nights (MMORPG, non-free)

TuxRacer (racing)

Frozen Bubble (puzzle)

FreeCiv (strategy)

ZSNES (Super Nintendo emulator)

SNES9X (Super Nintendo emulator)


In addition to these, KDE and GNOME both come with a plethora of software such as Koffice and GNOME Office, Kmail, Kmix and many others. If you are setting up a system for Mom, etc., most of these desktop environments come with solitaire and other card and puzzle games.


-IV.6-

How to Find New Software


As mentioned above, Sourceforge and Freshmeat are the two best sources for Free Software. Proprietary software can be found with a standard web search; simply include the word “Linux” in the search terms. If you want to find alternative word processors for GNU/Linux, you might try typing this into Google:


Linux word processors


Or you can ask members of the community through message forums and email lists. For the best results, don't ask what the best option is; ask what other people are actually using, why they like it, and if they'd suggest it for what you want to use it for. Those who ask, “What's the best Linux distro?” or similar questions are generally ignored.


-IV.7-

Installing Software


The method for installing new software depends on the distribution you're using and how it manages software packages. We've already listed the two main package management systems: DEB and RPM. Now we're going to talk about how to use them.

No matter what distro you're using, your window manager or desktop environment will not generally automatically add icons and menu options for newly installed software.

To add a new program to the KDE menu, you must click on the K menu, then on System, then on Kapplication Finder in order to make KDE search for new programs on your computer. In some cases KDE won’t be able to find the program you’ve installed, so it may have to be put into your K menu manually. To find out how to do this, consult the KDE manual which is preinstalled on your computer in the Help section of the K menu.

To add new programs to the GNOME “foot” menu, you'll have to add them manually. Click on the foot menu, then on Applications, then right click in the submenu. You'll see an option for “Add Menu Entry.” Click on that and follow the directions from there.

Other environments and window managers should have a help file or a document on their home page that tells you how to customize the menus and icons.


-IV.7.1-

Installing From Source Code


Regardless of which distro or package management system you're using, you can always add a program by downloading the source code and compiling it manually. There are two primary advantages to this method: you can compile the program specifically for your machine by adding or subtracting certain options and functionalities; you can also stay on the cutting edge of software development because new programs are always released as source code before they're made into distribution-specific packages. Some in the Linux community feel that programs built from source code, as opposed to being installed from a pre-compiled package, may provide a little extra performance on top of the greater customizability.

What are the disadvantages? It can take a long time (hours) to compile some larger programs (OpenOffice.org can take more than a day on some machines!), it's hard to keep track of installed programs, and there is no automatic feature for downloading the program's dependencies.


To install a program from source:


  1. Log in as root or use the su command to change to superuser mode.

  2. Download the files. Usually they are Gzipped tarballs (.tar.gz).

  3. Extract the tarball and untar the package as explained above.

  4. Change to the directory that the tarball created when you untarred it.

  5. Type ./configure and hit enter (this step will fail if you're missing a dependency).

  6. Type make depend and hit enter (some programs do not require this step).

  7. Type make and hit enter.

  8. Type make install clean and hit enter.

  9. You're done! If there were no errors or missing dependencies, the program is now installed. You may have to restart the computer in order to start the program outside of its installed directory. You can delete the directory that the tarball created – you don't need it anymore. If you ran into a dependency problem, you'll have to download the dependent program or library and install it before you can continue.

  10. Some programs have install scripts. Generally they end with a .sh extension, and you would run them by typing ./ and the name plus the extension. The ./ tells the operating system that you're running a command from the directory you're currently in; if you don't tell it where you're running the command from, it will search the system's default paths for the command you typed. So if the install script is called install.sh, you would type this:


./install.sh


If you get an error saying “permission denied” and you're logged in as root, you may have to change the permissions of the script to allow you to execute it. To do that, type this:


chmod +x install.sh


and then run the install.sh command as shown above.


-IV.7.2-

Guide to Gentoo GNU/Linux ebuild Installation




Gentoo Linux is source-based and therefore uses source code “ebuilds” instead of precompiled packages. An ebuild contains all of the dependency information that you'll need to properly install a program from source. So in effect the ebuild is like compiling from source as explained above, except all of the steps we've listed are taken care of for you and the dependencies are automatically retrieved.

All software was up to date when your operating system was installed originally, but it may become necessary from time to time to perform updates for security reasons – and of course to keep up with the latest software if that's your preference.

To perform an update to your system you must use the terminal. Simply click on the monitor/shell icon in your taskbar or select X-Terminal or Konsole from the K menu or foot menu. When the window comes up, type in su to switch to superuser mode (unless you're already logged in as root).

Next, type in emerge sync and hit enter. This will cause your computer to contact one of the rsync servers on the Internet and download information about the latest packages and updates available for Gentoo Linux.

When rsync is finished, type in emerge -uD world and hit enter. This will update all of the software on your computer. Be warned: it can take some time for this process to complete and in the meantime your system will run a little slower than usual, although it is possible to minimize the terminal window and work normally with the update running in the background.

If you’d like to install more software, the best way to do it is through Portage, Gentoo's package management system. Simply type in emerge -s and then the name (or part of a name) of the software that you’d like to search for. If you want to look for games, type in emerge -s games and see what comes up. If you’d like to install a specific application, type that in instead. For instance if you wanted the GNOME FTP program you’d type in emerge -s gftp and Portage will find the latest version for you, if it is available (broken or unstable packages are usually omitted from the standard Portage tree). Once you know what program you’d like to install, just omit the -s from the equation and Portage will download and install the program you specify. So if you want GNOME FTP, type emerge gftp and hit enter, and GNOME FTP will be installed on your system.

If you want to install a precompiled binary package, which will take up more space but install almost instantly, use the -g option with emerge. Not all items in the Portage tree have binary alternatives, so this will not work in all instances.


Commands specific to Gentoo:


emerge (portage installation command)

etc-update (updates config files used by X11 and desktop environments, sometimes necessary after updating system files. WARNING: sometimes this can erase your current configuration files, so make backups before running it!)


-IV.7.3-

Guide to Red Hat GNU/Linux RPM Installation




As mentioned above, Red Hat and Red Hat-based distros use the Red Hat Package Management format, or RPM for short. All RPM packages have the extension .RPM and you can pretty reliably find RPMs for whatever GNU/Linux software program you're looking for.

You do have the option of locating, downloading and installing an RPM on your own by using the command line interface, but it's much better to take advantage of your distribution's package management system if it has one. This system will keep track of all of your packages, their version numbers, and their dependencies. This is all very important information to have when it comes time to update your system, which a package manager can also do for you. Most major distros have package managers built in; SuSE has YaST2, Mandrake has RPMDrake, and you can download and install Ximian RedCarpet, which can be used with any distribution.

These systems are frighteningly easy to use, so we won't cover their operation in this document. Instead we'll detail how to install an RPM from the command line, which is what you have to do to install software in Red Hat Linux and some other distros that don't have fancy GUI package managers.


To install an RPM package from the command line, type this:


rpm -i packagename.rpm


where packagename.rpm is the name of the RPM that you've downloaded. If you're not currently in the directory where the package is located, you can include the path before the filename:


rpm -i /home/user/downloads/packagename.rpm


and if you know the correct FTP address, you can retrieve and install an RPM package directly from the Internet:


rpm -i ftp://ftp.redhat.com/pub/redhat/rh-2.0-beta/RPMS/packagename.rpm


To uninstall a package, type this:


rpm -e packagename.rpm


For more details, type man rpm


-IV.7.4-

Guide to the Debian GNU/Linux DEB Package Installation




The most common way to install DEB packages is by using the Debian package management program, APT. Here's how to use it:


To install a DEB package:


apt-get install packagename.deb


where packagename.deb is the name of the DEB package. This assumes that you've downloaded a DEB package and are installing it locally.


If you want to install from the Debian FTP site, type the name of the package instead, like this:


apt-get install gnome


or


apt-get install nano


This assumes that you know the exact name of the package that you want to install. If you need to search the package database, you'll have to use this command:


apt-cache search <search term>


where <search term> is the name or part of a name of a package or program that you want to search for.


If you want to find out more about a package, type this:


apt-cache show packagename


where packagename is the name of the package you'd like more info on.


To upgrade the software on your system, type this:


apt-get upgrade


and to remove packages, type:


apt-get remove packagename


where packagename is the name of the program you want to remove.

The dselect program can also be used instead of APT. It's basically the same thing with a text-based interface to allow you to sift through the full list of Debian packages. The dselect program can also install the packages for you. To start it, simply type in dselect and hit enter.


-V-

Useful Websites


Aside from the many sites already mentioned in this document, there are a few more that you may find helpful:


www.linux.com (a news source for Linux-related subjects)

www.rpmfind.net (very helpful in finding RPM packages)

www.linux.org (a source of information on GNU/Linux)

www.linuxhardware.org (a good source of GNU/Linux-oriented hardware reviews)


Copyright © 2003, 2004 The Jem Report. Verbatim copying of this document is permitted in any medium, provided this notice is preserved.

Back to Linux Links - Back to Site Index