:: Articles :: On The Nature of Linux
| 17 February 2003
|
On The Nature of Linux
By Mark Finlay
If you come from a Microsoft background
then your idea of an operating system is likely to largely involve a
piece of software that provides a GUI. And as far as windows is
concerned you would be right. But when you install Linux on your PC
you install far more than a GUI.
If you installed a desktop orientated
Linux distribution like Mandrake then you will likely see Linux the
same way that you always saw Windows: Nothing more than a GUI. But if
you have the courage to look under the hood you will realise that
Linux is a hell of lot more than that.
NOTE: In this article I am not going to
give you step-by-step instruction's on how to do anything. This
article is meant as pure theory, it is
designed to show you what Linux can do for you but not how to do it.
Where did Linux come from?
A Unix Ancestry
Linux is an open source clone of Unix. Both
Linux's and Unix's histories are long and complex so I am just going
to concentrate on what Linux inherited from Unix.
The two most important philosophies behind
Unix are:
1. Everything is a file.
2. Each program should be for a single
purpose and should perform that purpose well.
These idea's are the most important
inherited by Linux. The fact that everything is a file has benefits
that are beyond the reach of this article. The second philosophy is
one of the reasons for Linux's infamous
stability. Windows and other OSs have their GUI's integrated with
their kernel which means that when the GUI fails then the whole
system fails. Linux (as I will deal with later) is made up of layers
of programs working with each other. This
means that when the GUI, or any other part of the system, fails
usually only that part needs to be restarted.
A mainframe in my Livingroom?
Linux as a multi-user System
Another feature that Linux inherited from
Unix is it's multi-user functionality. Not in the way that Windows
allows multiple users. Linux acts more like the Unix mainframes of
old (and is equally as powerful ) in that different users can be
logged in to the system at the same time, or the same user can be
logged in multiple times simultaneously. This may seem like an
unnecessary feature for the standard user, but for the power user and
for servers this is invaluable.
So, you ask: How do I log in more than
once? Linux uses virtual terminals, usually six of them are
configured. They can be accessed by pressing CTRL + ALT + F[1-6] . To
get back to the GUI use CTRL + ALT + F7. You can also login in other
ways, like through telnet.
Layers of Linux
“Each program should perform one task and
perform it well”
Linux, at its birth, was a free Unix
kernel, and not an operating system. But since then the Linux
operating system has developed. It comes in the form of distributions
and is made up of the Linux kernel at it's core, and hundreds of
pieces of open source software surrounding
it to make it a full usable system.
1.
The boot manager
The boot manager is the first piece of
software that the computer runs when it boots. It ask's you which OS
you want to boot (eg. Windows or Linux). Then it hands over to the
kernel of the chosen OS. When booting Linux it is used to pass
settings to the kernel as well as information about which partition
is root.
2.
The Kernel
The kernel looks after the basic operations
of the computer. It looks after, among other things, most of the the
hardware. All input and output go through
the kernel. The Linux kernel is superior to a lot of other kernels in
many ways. One of these is that the BIOS is
only used to load the kernel into memory – after that the
kernel probes the hardware itself which circumvents
some problems with out of date BIOS's.
3.
INIT
The first thing the kernel does when it is
finished loading is to look for the INIT scripts(it is told where by
the boot manager). These scripts are what “boot up” your
computer. They load network interfaces, kernel modules and any
servers you run.
The last thing INIT
will do is create the virtual consoles on F1 to F6. It will then
display the contents of the file /etc/issue and run login
on each.
4.
Login
Login is a simple program that asks you for
your user name and password, checks if they are correct and if they
are it logs you in and runs the shell specified for your user
account.
5.
The shell
The shell is also know as the Command
line interface (CLI). It is the MS-DOS like interface that allows
you to enter commands to tell the computer what to do. Although
to compare it to MS-DOS is like comparing a monster truck to a
tricycle. The CLI is massively powerful, even more powerful that the
GUI to those who know how to use it.
Like everything in Linux there are many
different shells, to fit the needs of different people. The most
common shell is Bash.
6.
X
If your computer is set boot to X on
startup; after it has run login, INIT will launch X. You will be
asked to login via the GUI.
X is the piece of software that looks after
you graphics card and mouse(and keyboard while you are using X). In
the spirit of Unix is does this well and
does no more. If you run X by itself all you will see is a background
and a mouse pointer.
You might hear people
online mention the X Server. It is natural to assume that the
X server would only run on a Linux server and not on a Desktop
machine. But in fact every X is a server.
The applications connect to it the same way you connect to a website
– through a network interface*. This means that applications
are not limited to connect to the X server on their machine, they can
connect to any X server that will let them.
Also multiple X servers can run on one
machine. Different users can be logged into different X servers. Of
course only one user can sit at the computer so the others would
connect (usually from dumb terminals or under-powered machines)
through a network.
* This does not mean that Linux needs to be
on a network: a loopback interface (lo) creates a virtual network
within the machine.
7.
The Window Manager
X by can be used by itself but is much more
useful if used with a window manager running on top of it. As the
name suggests all a window manager does is looks after the windows.
It provides multiple desktops, window decoration, and a menu of
settings and programs when you click on the desktop(usually with the
third or middle mouse button). An example of a window manager is
sawfish.
8.
The Desktop
The two major desktops are GNOME and KDE.
They both run on top of window managers. They provide what most of us
consider a GUI. They provide the equivalent
of the windows “Start” menu and bar. They also provide
the widget set, and common dialogues(open, save, print) used by
programs.
The desktop is the topping on the cake and
because it is the only thing most new users interact with they are
rapidly getting easier to use and more intuitive.
9.
The Applications
There are three types of applications
on Linux: console applications, X applications and frontends.
9a. Console Applications
In the order of Layers of Linux these come
just after the shell. They are command line programs and are very
popular among Linux
“Guru's” because they are more powerful than GUI apps,
and give you more control, and if you know a command, it is quicker
and easier just to type it in that to go through layers of GUI
menu's.
9b.
X applications
Applications that can only run from X. Most
X applications use one of the standard widget sets. The most popular
are GNOME's Gtk and KDE's Qt. When you hear an application described
as a GNOME app or a KDE app that simply means that it uses either the
GNOME or KDE widget sets. (GNOME apps can run in KDE and visa-versa)
Widget sets
provide an easy way for programmers to give their programs a standard
interface. The widget set provides all the things common to a GUI:
menus, buttons, toolbars, etc ...
9c.
Frontends.
Frontends are X applications that provide a
GUI for a console command. As such the code
to execute the actual task performed by the program isn't loaded
until the console command is actually run. This makes frontends very
fast to use and load. An example of a frontend is any of the Linux
CD-Burning programs. All the frontend does is find out what files you
want burned and at what speed , etc, and pass the information on to
the console app. This is in the spirit of the “Each program
should be for a single purpose and should perform that purpose well”
philosophy.
Where is “C:”
?
The Linux Filesystem
The first thing that most newbies ask when
they open up the Linux file manager is “where is C:”.
Linux handles it's directory structure very
differently to windows. This takes a while to get used to but the
flexibility it provides is invaluable.
The Linux equivalent of C: is the
root filesystem. It is represented by / . The root filesystem
is specified by the boot manager and is where the
kernel finds the INIT scripts. So far this isn't that different to
windows but it becomes very different when you start adding more
partitions and removable media.
If I have a second partition in windows it
will be known as D: , I have no choice about that. In Linux I
mount the partition into the root filesystem. This means that
I choose a directory* on the root partition to associate with this
partition.
For example: on my computer I have a 30GB
storage partition which is mounted under /mnt/storage. This
means that when I browse to /mnt/storage I see what I would
see in windows by clicking on D:
The same applies for cd-rom's and floppies.
They are usually mounted to their own folders inside /mnt
An example of how this can be very useful:
A while back I ran out of space on my root filesystem, and I don't
like resizing partitions for fear of data loss. So I made a 1GB
partition, mounted it to /mnt/usr. Then I moved all the files
from /usr on the root partition to /mnt/usr. Then I
remounted the new partition to /usr. This is the equivalent of
being able to move the windows directory to a new partition when you
run out of space. NOTE: moving /usr is more complicated than I
described here – don't try it unless
you know what you are doing.
* If you mount a partition to a directory
with files in it – those files will be hidden until you unmount
the partition.
When do I need to reboot?
Linux's modular nature
One thing that you will be glad to leave
behind when you change to Linux is constantly being told that
“Windows needs be restart your computer for changes to take
effect”.
Because of Linux's modular nature, when you
change a setting you only need to restart the part of the system that
the setting applies to.
eg. If you change your IP
address you then only need to restart networking. If you
change your screen resolution then you only need to restart X. The
only thing that I can think of that needs a reboot is a kernel
upgrade.
Linux acts in the opposite way to windows:
the longer you leave it on the faster it gets. There are people who
have had a Linux desktop running for months without rebooting.
What about Linux NT?
A desktop built on top of a server.
In the Microsoft
world, until recently, the most stable software, Windows NT, was
confined only to the server room. If you are new to Linux then you
may have noticed that the is no Redhat NT. There are server versions
of the boxed sets. But you will find that if the Desktop box sets
contains cd-rom's A, B, and C then the server box sets will contain
cd-rom's A, B, C, D, and E. With D and E containing extra software
for use on servers. But the underlying system is the same.
When you install Linux onto your desktop
you install the same OS that is installed on web
servers all over the world. The only difference between a
Linux server and a Linux desktop is that the server will have more
servers apps installed and should have tighter security.
If you have a permanent connection to the
internet you can run a hybrid desktop-server. You can have your own
web server, ftp server, etc, at the same
time as doing your word processing and playing games.
In terms of stability and performance it
means that you are getting the best of the best.
Where do I get shareware for Linux?
Discovering the delights on your distribution CDs
I remember back in the day, having freshly
installed Windows 95: It just sat there looking at me in 16 colours,
at 640x480, offering me an arsenal of useful software like calculator
and notepad. To make it come anywhere close to usable
I had to add graphics and sound drivers, MS Office and IE4.
At that point I could get online so I went
“shareware hunting”. After a few hours I was armed with
PSP, Winzip, CuteFTP and a handful of other useful shareware apps. My
PC was useful, well for 29 more days anyway.
When I did my first install of Linux I
expected to encounter something similar. I downloaded at least 10
apps before I realised that they were all included as rpms on my
Redhat CDs. The day I realised that, I took
the phone off the hook and spent countless hours installing and
playing with everything I could find on the Redhat CD's. The next day
I woke up with a patchy memory of what I had installed, but when I
booted up my computer I was reminded when I saw at least 10 servers
starting during boot-up.
And now with such swish tools as Mandrake's
RPMDrake you can browse through all the software available
to you and even see descriptions of each
one. The only things that I have downloaded for Linux that I actually
needed were things like StarOffice and Java and NVidia
Drivers that can't be included with the distro for legal
reasons(although they are included in the
box sets).
A favorite quote
of mine sums it up nicely:
'Microsoft sells you Windows,
Linux give you the whole house'
Conclusion
To link back to what I said at
the beginning: Linux is far more that a GUI. It has a lot below the
GUI and a lot above it. I hope that you have a better understanding
of that now.
Enjoy...
Related: ILUG FAQ Linux In Naas CBS
You may find the following helpful: What the root directories contain
About the author, Mark Finlay.
USERS COMMENTS
|