An introduction to the Linux world -- by David Ward


This is intended to help explain the fundamentals of the Linux system and thus how to begin using one for leisure or business.

Table of Contents

The Linux file/mounting systems.

This was an issue that caused me trouble to begin with. Somehow I managed to skip this part of learning Linux initially and thus cause me confusion later down the track. The Linux file system makes a lot of sense but works quite differently from your familiar Windows drive letter system.

The first thing you need to do is clean out the idea of drive letters. This is a concept only introducted by Windows and doesn't exist anywhere else in the computer world.

The Linux file system (like many others) is a hierarchical system starting at / as the top of it all. To put it another way, / (a forward slash) is the core of your file system, it's where everything else is referenced from and denotes a folder. A user's 'home' directory (a place a user is put by default when opening a file browser of some sort and the area of the systems hard disk that a user can call their own and put/do anythying with/to) is located, under the 'root' or core of the file system (/) as /home/<username>. for example:

If my user name was david then my home would be in:


To further help explain this concept, an important concept to understand. You can think of / as like C:\ in Windows except that there is no D:\ or E:\ or Z:\ EVERYTHING resides under / if it's not under / then it does not exist. Sounds like an extreme comment that may have some exceptions ?? Think again. Abolutely EVERYTHING resides under / anything from your home folder to configurations of programs to physical devices to network shares and current running processes. Please re-read this again, even if you 'think' you get it :)

Now what and where things reside under / aren't terribly important to get started, just understanding the idea of this and thus knowing where to go if something says copy a file into /etc/system/ will help you greatly in using a Linux system.

File and Folder (directory) permissions and ownership.

This is the second of two issues i had managed to skip past when first starting with Linux. All files and folders in Linux have permissions set on them much like Windows does. Permissons simply means a way to govern who can read, write and execute certain files and folders. Its a way to keep curious users out of yuor home directory and other users out of system configuration files.

The system works on the concept of there being owner, group and other. This mean someone can own a file/folder and have rights to it; a group has certain access rights; everyone else has another. These 'rights' or permissions are broken into 3 types (previously mentioned): Read, Write and Execute. They are listed in that order, for example:

rwxrwxrwx 1 david david 3717212 Jan 25 13:58 storage/Programs/gaim-1.1.1-1.101mcnl.i586.rpm*

The first 9 letters displays the permissions. the first 3 letters are the owners rights on the file, the next 3 are the groups rights and lastly the final 3 are everyone elses or world's permissions on the file. To break that down more closely rwxrwxrwx means that the owner has Read, Write and eXecute permissions of this file; rwxrwxrwx means the group that owns this file (which means every member thats listed in that group) has Read Write and eXecute permissions; and lastly rwxrwxrwx means the whole world can Read it, Write to it and eXecute it.

Very often errors in the running of programs can be traced back to a simple persmission error. This is because many programs run as their own user account such as Postfix mail server runs as user 'postfix' Apache web server will run as user 'apache' and so forth. Therefore for apache to run right it needs to be able to read its configuration files and write to folders that its working in, if the permissions are set where someone else owns these files and only the usr have permission to read or write to the that file/folder you will have errors in starting the program.

To change the permissions on files that you own (or don't own but you are the root user and allowed to do anything) you can access the properties of the file/folder (see fig 1.) and set them there. Alternative you can use a terminal. Don't be scared, its easy. Simply cd (see appendix) to the file and issue something like chmod <who>+/-<permission> where who is either:

  • u for user or owner,
  • g for the group,
  • o for other and,
  • a for all.
Additionally the permission part can be either
  • r for read,
  • w for write
  • x for execute

So putting this together we can add the write permission for the owner of the file with chmod u+w <filename>. Or we could add the read permission for the rest of the world (other) with chmod o+r <filename>. Or we can remove the read permission for the rest of the world with chmod o-r <filename>.

This all translates to a numercial system as well. 4 is read 2 is write and 1 is execute where the addition of the permissions is used. For example 4 would mean read, 6 would mean read+write (4+2), 5 would mean read+execute (4+1), 7 would mean read+write+execute (4+2+1) and 3 would mean write+execute (2+1). Any combination can be used. These then line up with user, group and world, for example: chmod 755 hello.txt would give the file 'hello.txt' permission of read+write+execute for the owner and read+execute for both the group members and other/rest of the world. Put in another way chmod 755 would give rwxr-xr-x when listing the file.

This may be beginning to sound complicated and i recommend you use your particular distributions (flavour or brand of linux) Graphcial manger to change permissions, at least to start with.

Configuration Files.

In Linux systems all the configurations (or settings) you set for programs and personal effects are stored in simple, plain, old text files. The layout of them have a similiar theme but each are generally unique. Most have comments in them (lines of text that the program will ignore when reading the file but humans can read it) that help explain the settings in them.

This may make the whole setting of settings a tedious task. Indeed it is different to the way Windows does it, but has its advantages.

  • You can schedule backing up (or copying) of your important config files to some 'safe heaven'.
  • You can edit/change vital settings you have changed that doesnt permit your system from booting. Wise to test first but these things happen.
  • Using configuration files makes it very easy to edit/change settings through a simple bash (like batch) script.
  • Makes it very easy to pass on your settings to someone else for a particular program or several to someone with a similiar system. Especially if there are alot of them.

As you can see there are many advantages here with the only disadvantages that i see being:

  • A typo will serverly effect a program,
  • Somewhat daunting to begin with having to edit text files.

Thats basically it on this matter as each particular config file and thus program has different settings; a little googling and reading of the comments in the config file should get you started on each particular programs config file or try issuing the command "man <config-files-name>.

Some common config files are:

  • /etc/fstab: File System TABle. Used to set what partitions and optical devices get mounted where in the file system on boot or upon the "mount -a" command.
  • /etx/X11/XF86config: Display properties.
  • /etc/passwd: system user accounts their shells and other details.
  • /etc/shadow: a partner in crime with passwd but contains encrypted passwords and other details.
  • /etc/resolv.conf: a linked file that contains yuor DNS (Domain Name Servers) addresses.
  • /etc/rc.local: a linked file that contains startup scripts. A good place to add commands you want executed on start up.
  • ~/.kde/Autostart: not a config file place a folder that the contents get executed when KDE starts. If a text file has the executable permission set it gets executed as a script otherwise the it will openned in a text editor like kwrite.
  • ~/.desktop: contains what Graphical display manger is that users default. I have "DESKTOP=KDE" in mine for example.
  • /etc/inittab: The init table. Here you can set the default runlevel.
  • /etc/sysconfig/network-scripts/ifcfg-eth0: This is where Mandrake-Linux holds information about your default ethernet adaptor.

The concept to learn here though is that configurations or settings for programs or anything are kept in configuration files or config files. These are mostly kept in /etc for system wide settigns or in your home (~/) as a hidden file (preceeds with a dot) for personal settings.

Intro to bash

Using a terminal is nothing to be afraid of. Unlike DOS, bash helps you along the way and damn near does all the work for you. So go ahead and open up a terminal. There could be any number of flavours of terminals on your system such as:

  • XTerm
  • konsole
  • RXvt
  • Eterm
  • console

To begin with, here are some main commands and description you should learn first:

ls short for lists, lists everything in your current folder/directory.

pwd Print Working Directory, prints to the screen where you currently are in your system.

cd Change directory, moves you to a folder of your choice.

su substitute user, become root user.  If done with a user name after it, means your becoming that user.

exit exit that user, or if you have ssh'd into another system, exit that system.

For those that have used DOS before, if shouldn't be hard to pick up.  But for new user who hasn't seen a termnal or MS-DOS prompt, this might all seem a bit daunting.  The bash shell helps out as much as it can.  Try by typing pw and hitting the <TAB> key.  You will see that it either complete the command to pwd or if you were root, offer you a few options of what you meant.  Try hitting <TAB> with nothing entered yet.  There's a few commands to your disposal isn't there?

The <TAB> key auto completion is invaluable when using the command terminal and is relied upon by many people.
Another point to mention here is that you can execute programs from anywhere.  You dont need to in the directory that executable program resides to launch it. 

One more note to make before closing.  Trying pushing the up arrow on your keyboard.   That could come in handy couldn't it ???

Written by David Ward in kate
All content is released under a GNU Free Documentation License.