52midnight.com/linux

52midnight.com/sea
Basic Linux
Fundamental concepts

   

LINUX ONLINE

HELP

Providing online help is where Linux shines. It's free, quick, easy, highly expert, and far friendlier than what you're used to from other OS's.

VENDORS

Several stores in Australia sell Linux Live CDs and install disk sets. Click here for a short list.

DISTROS

Linux is available as a large number of distributions or distros. Those below are recommended, but a full list is at  DistroWatch.com

KNOPPIX

The original and still one of the best Live Distros that runs directly from CD without being installed. Best choice for Beginners, and as a rescue disk.

UBUNTU

Enormously popular, simple Gnome desktop, very helpful forums, a good 'plain vanilla' choice for new Users.

PCLinuxOS

Very easy to install, powerful KDE desktop, friendly forums, more 'ice-cream sundae' than 'plain vanilla'.

VECTOR LINUX

"Keep it simple, keep it small" is the idea behind a fast system that still has everything needed.

PUPPY

Small, fast, many features, ideal for older machines. Can be run from a USB stick

52MIDNIGHT

Projects
Archives
Electronics
Computers
Linux

DIRECTORY CONVENTIONS & STRUCTURES

Directory conventions

The strict formal names of directories are followed by a slash (e.g. /home/) to differentiate them from files. However, this is never done in command invocations. The convention is followed below to assist the reader in making this differentiation, but should not be followed in daily use.

Users should carefully distinguish between the root directory (i.e. / - the origin of the entire directory structure) and the Root User's Home Directory (i.e. /root/). Although somewhat confusing at first, the distinction soon becomes obvious.

The root directory

Linux uses a directory scheme structured like an inverted tree. Its origin is named the root directory and denoted by a fore-slash (/) Within this are subdirectories containing files and lower-level subdirectories. Only a few basic system files are ever placed in the root (i.e. highest level) directory - all other files are stored within the appropriate subdirectories.
Table 1   A standard root directory tree.
/bin/Executables - i.e. general use program files.
/boot/Programs used during boot.
/dev/Interfaces to hardware devices.
/etc/Configuration files.
/home/User Home Directories.
/initrd/Used by boot.
/lib/Program libraries.
/lost+found/System housekeeping.
/mnt/Mountable devices.
/no-backup/Backup exclusions.
/opt/Optional packages.
/proc/Used by Kernel.
/root/Home Directory for Root User.
/sbin/System executables.
/tmp/Temporary files.
/usr/User programs.
/var/Variable files.

The Root User

There is only one Root User per system and this user has the login name root. Other users have restricted access to file and programs in order to ensure privacy and security between users, and to protect the system from accidental or deliberate damage. The Root User has unrestricted access to the entire machine, and this privilege must be used with care. Root access is protected by a password, and can be invoked by any user knowing it.

Home Directories

Every user is assigned a Home Directory. The Root User's Home Directory is on the Root Directory at /root/ All other Users have a directory with their login name in the /home/ directory, e.g.

/home/user1/
/home/user2/
etc

The user's Home Directory is denoted by the tilde: ~/

The Bash Shell

A standard linux login is to a bash shell (the Bourne Again SHell). Bash is configured by two files at the system level and two more in each User's Home Directory:

/etc/bashrc
/etc/profile
~/.bashrc
~/.bash_profile

A filename beginning with a "dot" or period is a "hidden" or system file, but is much the same as ordinary files. Standard directory listings omit the system files ("dot files") for clarity. Before modifying any system files, the originals should be copied to an appropriate directory as explained below.

The System Configuration Directory /root/cfg/

Within the /root/ directory a subdirectory named "cfg" should be created, that is, /root/cfg/ Withing this a further subdirectory named "original" should be created, i.e.

/root/cfg/original/

and within this again another directory named "root" to give:

/root/cfg/original/root/

By copying all original files in the /root/ directory into it, this becomes the repository for all original files in the /root/ directory. The two original bash configuration files can be stored here as:

/root/cfg/original/root/.bashrc
/root/cfg/original/root/.bash_profile

The edited files can be stored in a "default" or "customized" directory:

/root/cfg/custom/root/.bashrc
/root/cfg/custom/root/.bash_profile

A mirror tree of the root directory (i.e. /) can thus be built within /root/cfg/original/ to contain the originals of all modified configuration files. The standard Mandrake directory structure is given in Table 1. Most system configuration files are in /etc/ or one of its subdirectories, and the /root/ and /etc/ directories are usually included in standard backups.

User Configuration Directories

The same procedure can be followed by each User to preserve their original configuration files. User Home Directories are in the /home/ directory, and User1's Configuration Directory will therefore be:

/home/user1/cfg/

COPYING  FILES

Files and directories can be copied at the commandline using Bash's cp command:

$> cp FILE_1 FILE_2

Far easier and more convenient is to use a text-mode file manager, the one here recommended being Midnight Commander or mc

Click here for more information about Bash commands and the commandline.

TERMINAL COMMANDLINE

Starting a Terminal

From the KDE Desktop, click the Main Menu icon, the Terminals item, then the Konsole item:

MainMenu > Terminals > Konsole

This opens a window containing a shell prompt in an X-term, wherein begins a new path for exploring the internal operations of the machine.

The Command Prompt

An empty commandline contains only the command prompt, the default being:

[user1@localhost: /root]$

The first section within the square brackets gives the user login ID and hostname of the computer, the second part the Current Working Directory. The dollar sign $ indicates a normal login, and changes to a hash sign # for a root login. For convenience we will abbreviate these to:

Normal login command prompt:$>
Root login command prompt:#>

UID and GID

Click the mouse in the Terminal window to ensure that it is active, then issue the id command and press the Enter key:
$> id

Only the letters id should be entered - the prompt will already be there. This will result in something like the following:

$> id
uid=500(user1) gid=500(user1) groups=500(user1)
$>

Each user on the machine is assigned a User IDentification number (UID). Root always has the UID of zero, and normal UID's start at 500, with smaller numbers reserved for system users. Each user is also assigned to a group, by default a group with the same name and having the user as its sole member. The Group ID (GID) is therefore often the same as the UID, but need not be so. Other group memberships are listed last by the id command.

Basic Navigation Commands

Next enter the pwd command to get something like:
$> pwd
/home/user1
$>

The Print Working Directory command prints the name of the user's Current Working Directory. Following login this is the user's Home Directory located in the /home main directory and defaulting to the user's login name.

The ls command lists the contents of the Current Working Directory:

$> ls
Desktop/  Documents/  tmp/
$>

The forward-slash / character following the names indicates that they are directories, not files, and these three directories are installed for all normal users in a Mandrake/KDE system.

The cd command allows the working directory to be changed. Issued on its own, it always changes to the user's Home Directory. Issued with the name of a valid directory, it changes to that directory. Try issuing the following command sequence:

$> cd
$> pwd
/home/user1
$> cd /home
$> pwd
/home
$> ls
user1/  user2/
$> cd
$> pwd
/home/user1

The pwd, ls and cd commands are the basic three needed to navigate a Linux Directory Tree, and should be memorized before proceeding further.

Relative and absolute addressing

This is a good time to emphasize the difference between absolute and relative addressing. Within the User's Home Directory, the ~/cfg directory can be referred to simply as cfg, this being relative to the Current Working Directory. From other directories it can be accessed using the absolute address /home/user1/cfg  
 

LINUX ONLINE

HELP

Providing online help is where Linux shines. It's free, quick, easy, highly expert, and far friendlier than what you're used to from other OS's.

VENDORS

Several stores in Australia sell Linux Live CDs and install disk sets. Click here for a short list.

DISTROS

Linux is available as a large number of distributions or distros. Those below are recommended, but a full list is at  DistroWatch.com

KNOPPIX

The original and still one of the best Live Distros that runs directly from CD without being installed. Best choice for Beginners, and as a rescue disk.

UBUNTU

Enormously popular, simple Gnome desktop, very helpful forums, a good 'plain vanilla' choice for new Users.

PCLinuxOS

Very easy to install, powerful KDE desktop, friendly forums, more 'ice-cream sundae' than 'plain vanilla'.

VECTOR LINUX

"Keep it simple, keep it small" is the idea behind a fast system that still has everything needed.

PUPPY

Small, fast, many features, ideal for older machines. Can be run from a USB stick

52MIDNIGHT

Projects
Archives
Electronics
Computers
Linux