Linux: Getting Started

RedHat (the easiest distribution to buy) is what i use, so i will be biased towards it on this page. To be fair, there are other non-RedHat distributions out there with their own merits, but since i haven't really tried them, i can't say how good or bad they are. See the GetLinux section of linux.com for more info on various distributions. Watch out for out-of-date distributions on shop shelves though. Today [7Oct2000] PC World in Bristol (Cripps Causeway) had RedHat 6.2 on one shelf, and had RedHat 5.2 two shelves below.

IMO one of the main things that puts people off installing Linux is perceived "danger" of losing data. Installing Linux can be (within limits) as "safe" or as "dangerous" as you like. Anyway, below i will assume that you have a reasonably good grasp of Dos and/or Win9x, and know your hardware (especially the 2D graphics card).

Possible installation & bootcode locations

You have various choices about where and how you can install Linux:

  1. Destructive repartitioning: This is where one (or more) existing partitions are deleted to make some space, and then new partitions (for Linux)  are created. Data on the deleted partitions is lost.
  2. Non-destructive repartitioning: This involves some trickery to change the size of a partition, without causing loss of data. The normal way is to use fips.exe, which splits a partition into two, one of which will only contain unused space, so you then delete this partition to make room for the Linux ones. It doesn't involve the loss of data, but if things do go wrong (most likely through deleting the wrong partition), it is potentially serious.
  3. New hard drive: Simple enough. Buy new harddrive, wire it up, and install Linux onto it. Things can get a bit tricky if you've already got more than one harddrive, and it is the most expensive option, but Linux will be kept well away from your existing data.
  4. UMSDOS: This is where Linux uses a FAT16/32 partition, and uses hidden files to keep track of file attributes. FAT16 drives may have problems as Linux installations have an enormous number of small files, but FAT32 should be OK. You have to be a bit careful when viewing the Linux file directories from Dos/Win9x , but this method has the advantage that free space is available to both Linux and Dos/Win9x.
  5. Partition in a file: This is where a native Linux filesystem is contained within a file on a FAT16/32 harddrive. It doesn't involve repartitioning, but any space you allocate to Linux becomes unavailable to Dos/Win9x. Its also too easy to trash the installation in a fit of rage. PhatLinux and LoopLinux use this method.
I think method 3 is the best because you don't have to mess with repartitioning, yet you can install a mainstream distribution (which tend to want Linux-dedicated partitions). Installing new hardware is also fairly safe if you know what you are doing. I've never bothered with backups when doing hardware upgrades, although i do have firsthand knowledge of what it is like to lose irreplaceable un-backuped data.

Note: The situation may have improved recently, but i think that FAT16/32-based distributions (especially the smaller ones) give an exceptionally bad impression of Linux to new users.

Boot method: OK, Linux is an OS. How does your system boot it up instead of Win9x. Well, here's some brief details: The start of each harddrive has a small area known as the MBR (Master Boot Record). Among other things, this area contains the program code that gets called when the system is switched on. Also, each primary partition contains a boot sector which is similar. Under Dos/Win9x (and possibly NT), the bootup procedure is something along the lines of:

  1. BIOS passes control to MBR code.
  2. MBR: Searches first harddrive for an 'active' partition and passes control to its boot sector.
  3. Boot sector code loads Dos/Win9x (assumes its on same partition)
The boot code in the MBR (or a primary partition) can be replaced with Lilo. Lilo is capable of either passing control onto another boot manager (not sure if this can be another copy of Lilo or not), or loading Linux from an arbitrary partition. Lilo can even be placed onto a floppy disk (should be removable once Linux has booted up). The Lilo Readme (which is where i got the above information from - its in /usr/doc/lilo-0.21/ under RedHat 6.1) goes into much more depth. Boot manager (and Lilo) setups itself is an enormous topic. The Lilo documentation is very good, so most of the Lilo-related HOWTOs tend to be a bit cookbook-like for specific cases.

Personally i've never used Lilo. I use LoadLin.exe instead. LoadLin loads up Linux from the dos prompt, so you don't have to play around with MBRs and boot sectors. You have to keep LoadLin (and a copy of the kernel file) on either a FAT16/32 partition, or a Dos-format floppy disk, but it is the least risky booting method.
 
 
Quick intro to partitions

Suppose you have a system with this sort of drive arrangement:
        A: - 1.44" disk drive
        C: - "Hard Drive"
        D: - CD-Rom drive
C: Actually refers to a HardDrive partition (ie a specified section of the harddrive) rather than a harddrive itself. To illustrate this, lets suppose you have a slightly different system:
        A: - 1.44" disk drive
        C: - "Hard Drive"
        D: - "Hard Drive"
        E: - CD-Rom drive
Since C: and D: refer to different partitions, you cannot tell whether C: and D: are two separate physical harddrives, or two partitions on the same harddrive.

Each harddrive can contain upto 4 Primary Partitions. These partitions are identified as hdXY where X is the harddrive the partition is on, and Y is the partition number (1-4). For instance, hda2 is the second Primary Partition on the first harddrive. One of the Primary Partitions can be made into a 'container' partition that holds extended partitions. Extended partitions are also identified using hdXY, except that Y is between 5 and 16(?). If this seems odd, it is a leftover from the days when a large harddrive had a capacity of 30mb.

Note: If you've got a SCSI harddrive, then your harddrives are identified using sdXY. If you don't know if your harddrives are SCSI or IDE/EIDE, the odds are that they are IDE/EIDE.

If the above still confuses you (likely), then look at RedHat's attempt to explain it. Also, have a glance at the Partiton-HOWTO.
 
 
Accessing disks & partitions, filesystems, and mounting

When Dos/Win9x boots up, it searches for readable partitions, and any partitions that are readable are assigned drive letters in the following pecking order :
        hda1-hda2 (primary partitions on 1st harddrive, in ascending order)
        hdb1-hdb2 (primary partitions on 1st harddrive, in ascending order)
        hda5-hda16 (extended partitions on 1st harddrive, in ascending order)
        hdb5-hdb16 (extended partitions on 2nd harddrive, in ascending order)

On one of my systems, this comes out as:
        hda1 - C:
        hda4 - container partition (not assigned)
        hdb1 - container partition (not assigned)
        hdc1 - Not recognized (Linux partition; not assigned)
        hdc2 - container partition (not assigned)
        hda5 - D:
        hda6 - E:
        hda7 - F:
        hdb5 - G:
        hdc5 - Not recognized (Linux partition; not assigned)
        hdc5 - Not recognised (Linux partition; not assigned)
        hdc5 - Not recognised (Linux partition; not assigned)
        hdc5 - Not recognised (Linux partition; not assigned)
        SCSI CD-Rom - H:

Not exactly elegant. Under Linux, partitions are given explicit identities for reading/writing (either by the OS installer, or by the user). Even better, access identities can be given (and removed) on the fly - processes known as mounting and unmounting.

Before i go on, i must introduce the concept of a filesystem. A filesystem is basically something that contains files, be it a harddrive partition, a floppy disk, or a CD-Rom. Under Linux you can even have a filesystem within a file. Before you can use a filesystem, you have to mount it. When you've finished with it, you have to unmount it. Mounting/unmounting is a familier(ish) concept to Macintosh users, even if it is hidden a bit by forcing disk ejection to be done via a menu option rather than pressing a button on the drive.

One consequence of this generalization of filesystems is that you have to unmount floppy disks before removing them (this is because the same buffering used on harddrives and CD-Roms is used on floppy disks - Win95 doesn't buffer Floppy disk access). There are utils out there that allow Win9x-style treatment of floppy disks, though i haven't tried them myself.

Under Win95, each partition/drive is assigned a letter (C:, E:, etc). Under Linux, mounted filesystems become part of one enormous structure. Linux simply takes a filesystem, and makes it accessible as if it was a subdirectory. For instance, consider:
    /etc/
    /lib/
    /
    /home/necro/WWW/
    /home/guest/
..you cannot tell just by looking that (on my system) the first 3 are one one partition, and the last two on another. In Windows-speak, this allows things like having c:\win95\ and c:\win95\system\ on separate partitions, although people don't normally go that wild with partition location. Removable media mount points are usually located under /mnt/ (eg/mnt/cdrom).

Note: A standard RedHat 6.1 install will only allow those with superuser privileges to mount media (this is for security reasons - see ). For a single-user Linux setup, this doesn't really make much sense, so run linuxconf, go into Config->File systems->Access Local Drive, and set the 'User Mountable' option.
 

Manual mounting: More often than not, this simply involves using the mount command with a mount point, for instance:
    mount /mnt/floppy
    mount /mnt/cdrom
    ..etc..

However, occasionally you will need to use some manual options. For instance:
    mount -t msdos /dev/fd0 /mnt/floppy
    mount -o readonly /dev/hda1 /mnt/Cdrive

The first mounts a Dos-format floppy disk at mount point /mnt/floppy, and the second mounts /dev/hda1 (usually C:) at /mnt/Cdrive in readonly mode. Use the command man mount to find out more information on mounting. The real fun starts when you start mounting filesystems that are contained within files. Now guess why i think Linux games generally don't bother with CD detection..

Note: I personally created a special mountpoint for Dos disks. This is doable from Linuxconf.
 

Manual unmounting: This is fairly simple. Make sure your current directory is not within the mounted disk, and then use the umount command. For instance:
    umount /mnt/floppy/

If it is successful, you won't see any messages and you'll be dumped back at the command prompt. Note that it may take a while if write buffers need to be flushed (Linux does a LOT of read-ahead and write-behind buffering, even with removable disks). If it complains a device is busy, odds are that you've got a console window somewhere that has a directory on the filesystem as its current directory.
 
 
My installation experiences..

I always do a custom install, although i don't change many options. Anyway, here's a few in-my-experience things to watch out for:

Disk Druid: This takes into account potential BIOS/Lilo limitations when setting new partition positions (more specifically /boot, or if /boot is absent, /). Unfortunatly, it doesn't seem to be overridable if you want to do what i did and place ALL Linux partitions onto a 3rd harddrive. I don't even use Lilo anyway. I had to use Fdisk instead to create the partitions, and then go back into Disk Druid to set partition mount points. Nice case of 'user-friendliness' gone wrong. linuxnewbie.org has a fairly detailed guide to setting up partitions with fdisk. Details on Disk Druid are also available.

Note: Note down which partition you assign as root partiton (the one with just a '/' as a mount point).
 

LILO-less install: It is advisable to make a bootdisk during installation. At least then you have a way of booting into Linux in order to copy the Linux kernel image to a dos partition (or a dos floppy disk). I think the installation program loads Linux immedatly after installation ends (without rebooting) if your installing off a local CD-Rom, but i'm not sure. Network installs certainly reboot the system. To locate the Kernel image, type -l /boot/linu* and you'll get something much like:
    -rwxr-xr-x   1 root     root      1544394 Sep 27  1999 /boot/vmlinux-2.2.12-20
    lrwxrwxrwx   1 root     root           17 Apr  4 00:41 /boot/vmlinuz -> vmlinuz-2.2.12-20
    -rw-r--r--   1 root     root       622784 Sep 27  1999 /boot/vmlinuz-2.2.12-20

you want whatever file vmlinuz points to (vmlinuz-2.2.12-20 in this case - the filename changes depending on kernel version). Once you've got the file and a copy of loadlin.exe (located within the dosutils directory on your RedHat CD - the CD is Dos/Win95 readable) in the same place on a dos disk/partition, run:
    loadlin vmlinuz root=/dev/hda6 ro mem=256M

vmlinuz is the Kernel image (renamed from vmlinux-2.2.12-20 because of Dos name length limitation.
root=/dev/hda6 tells loadlin that my root partition is hda6
ro stands for readonly. Leave that parameter unchanged.
mem=256M is optional. (detailed bwlow).

Note:If you end up with no bootdisk, no kernel image on a dos disk, and no Lilo (as happened to me more than once), then all is not lost, but things start becoming a real pain.
 

Linux only sees first ~64MB of memory: This problem sometimes comes up. Try typing cat /proc/meminfo (or if in KDE, look at K->settings->information->Memory) and look at the MemTotal value. If it reports an amount a lot less than what you have installed on your system, add mem=256M to the end of your loadlin commandline, having changed 256 to the amount of memory in your system.

Note: The Kernel will blindley believe whatever value you give it. If you give a value more than what you've really got, Linux will eventually hang. If adding the parameter still hangs and you've set the right amount, try reducing the number a bit. More details are in the (rather lengthy) Loadlin+Win95-HOWTO.
 
 
 

X-server-setup: This can be anything from an autodetection walk in the park to a post-installation manual XFree86 v4.x tarball-athon with /etc/X11/XF86Config-hacking day-trip to hell. Its not necessaraly the hardest things to get working, but it can easily be the most annoying because with most other bits of hardware, you can at least have a HOWTO open in a browser window at the same time.

Note: RedHat 7.0 includes XFree86 v4.x as standard.

I think most cards work with at least the generic SVGA 640x480 driver, but for higher resolutions, you need more specific ones. Here's the cards i have personal experience with, but for others, you are pretty much on your own (it may be wise to check compatibility lists for issues beforehand):

More often than not, you can get 2D working with reasonable results. However, if you've got recent hardware (GeForce, VooDoo5), and you want fast 3D performance, odds are you will  have to dump the distribution-included X-server and install XFree86-V4 (technically still in beta). This is discussed in the OpenGL section of the main Linux page.

Note: For some reason, X-server display drivers are also called servers as well.
 
 
Glossery

Backup: An age-old (and equally ignored) concept of making copies of files in case the computer should become inoperable (or worse).

Broken: Loose computer term. Basically refers to the existance of problems that have significant effects on usability.

Console: A window (or screen) where you can type in text commands.

Core Dump: Linux, by default, is setup to do a dump to disk of a program's memory core if it SegFaults. The resulting files (named 'core') tend to be large, and pretty useless to non-programmers. Core Dumping can be disabled, but i'm not sure offhand how..

Ext2fs (Extended2-filesystem): Linux's native filesystem.

FAT16/32: The filesystems Dos and Win9x use. FAT16 supports harddrives upto 2.1GB, and each partition is divided into (i think) 65,536 clusters. On a 2.1GB drive, space would be allocated in 32KB chunks, so large numbers of small files result in wasted space. FAT32 (only readable by Win95-OSR2, Win98, WinME(?), and Win2000) basically upped the limits to get over these problem on large harddrives.

Filesystem: Generalised term for something that contains files (be it a partition, a floppy disk, or a disk-image file).

Hard link: This is the link between filesnames and physical storage locations on storage media. Linux permits multiple files to point to the same iNodes  Odds are you'll never have to deal with hard links.

Home directory: User-private directories where files (such as user-specific configurations) are stored.

Kernel: The lowest level of the OS. The Kernel provides an interface with the hardware, and handles tasks such as memory managment and process control.

Local (as in local drives, local printers): Resources attached to the system directly (as opposed to accessable via a network).

Localhost (ala 127.0.0.1): This system.

Root; Root privilages: 'Root' is the name of the administration account on Unix/Linux boxes. Whenever your operating with root privilages, the $ in consoles changes to a #. Treat this as a warning, as root privilages allows you to do just about anything (including destorying of harddrives in one go), usually without asking for confirmation. Don't use the root account for day-to-day usage.

rpm (Redhat Package Manager): An attempt to bring an 'Add/Remove Programs' type interface to Linux. Some veteron users hate it, but it makes things easier (most of the time) for people who don't want the hassle of handling tarballs.

SegFault (aka Segmentation Fault): Same concept at Win32's Segmentation violation. Happens when a program is caught accessing somewhere in memory it shouldn't..

Shell: A text-based interface used in consoles. Examples are Dos's command.com and bash.

Superuser privilages: See 'root'

Symbolic Link (aka SymLink, Soft Link): Simular to Win32's .lnk files. Opening a symbolic link really opens up the file (or directory) it points at.

tarballs: .tar.gz (or .tgz) files. Made by sticking files together with the tar utility, and then GZipping the resulting .tar file (can be extracted by using tar -xzf). I prefer using zip/unzip for archiving myself..

Virtual Console: Linux allows multiple logins, each on their own screen. You switch between Virtual consoles using Ctrl-Alt-Fkey.
 
 
 
 
Console usage and commands

Shells basically provide the interface in consoles and shell windows. The shell translates what you type into system commands. Under Dos, command.com is the shell. On RedHat (at least 6.1 and 6.2) systems, the default shell is Bash, and normally has a prompt much like:

[necro@NecroPolis WWW]$

In this case, its telling me that i'm logged in as 'necro' on the system named 'NecroPolis', and i'm currently in the directory named 'WWW'. The $ changes to a # if the shell is operating with superuser privilages. I think the info that is shown by the shell prompt can be changed, but i'm not sure how.

Note: When changing a command line, Dos/Win9x defaulted to overwriting characters. Bash defaults to inserting them.

Now for some useful console commands:
 

Linux command Dos/Win9x equivilant Notes
ls, dir dir 'dir' only works in some Linux distributions (such as RedHat)
rm del, deltree Linux will normally not ask for confirmation, even for recursive (deltree-like) deleting.
cp copy Destination must be specified
mkdir, rmdir mkdir, rmdir, md, rd
cd cd
man <cmd> Gives details of the command <cmd> (if available)
pwd Displays current directory name (odd choice of name though..)
passwd Changes user's password
exit Exits current shell. If shell is login shell, also logs user out.
logout End current login session
ps -aux Lists all running processes
ps -ux Lists all running processes owned by current user
kill <process id> Send termination signal to program. If that fails, the more vicious 'kill -9' can be used.

Short name completion: If you press the tab key, Bash attempts to complete the command/filename you've typed part of. If there's multiple possible completions, pressing tab again lists them. Experiment with it. Useful as some Unix filenames are very long.

Directory shortcuts: to save time, you can use these shortcuts
    ./ - Current directory
   ../ - Parent directory (eg if in /usr/local, this points to /usr/)
     / - Root directory
    ~/ - Current user's home directory (eg /home/necro/)

PATH statement: This parameter is much like the PATH enviornment variable under Dos/Win9x. One major difference is that the current directory is NOT hardcoded. If you want to run a program in the current directory, you either have to append ./ to your command (eg ./newlycompiled), or add ./ to the PATH statement using:

    PATH=$PATH:./

If you want to make it pernament, in ~/.bash_profile change
    PATH=$PATH:$HOME/bin
    to
    PATH=$PATH:$HOME/bin:./
 

Command history: Simular idea to DosKey. Up/down arrow brings up previously executed command lines.
 


(c) Necro, 2000. Designed with Netscape. Validated. for HTML v4.0