Monday, June 7, 2010

The Linux filesystem

The first thing that most new users shifting from Windows will find
confusing is navigating the Linux filesystem. The Linux filesystem
does things a lot more differently than the Windows filesystem.
This article explains the differences and takes you through the
layout of the Linux filesystem.

For starters, there is only a single hierarchal directory structure.
Everything starts from the root directory, represented by '/', and then
expands into sub-directories. Where DOS/Windows had various partitions and
then directories under those partitions, Linux places all the partitions
under the root directory by 'mounting' them under specific directories.
Closest to root under Windows would be c:.

Under Windows, the various partitions are detected at boot and assigned a
drive letter. Under Linux, unless you mount a partition or a device, the
system does not know of the existence of that partition or device. This
might not seem to be the easiest way to provide access to your partitions
or devices but it offers great flexibility.

This kind of layout, known as the unified filesystem, does offer several
advantages over the approach that Windows uses. Let's take the example of
the /usr directory. This directory off the root directory contains most of
the system executables. With the Linux filesystem, you can choose to mount
it off another partition or even off another machine over the network. The
underlying system will not know the difference because /usr appears to be
a local directory that is part of the local directory structure! How many
times have you wished to move around executables and data under Windows,
only to run into registry and system errors? Try moving c:windowssystem
to another partition or drive.

Another point likely to confuse newbies is the use of the frontslash '/'
instead of the backslash '' as in DOS/Windows. So c:windowssystem would
be /c/windows/system. Well, Linux is not going against convention here.
Unix has been around a lot longer than Windows and was the standard a lot
before Windows was. Rather, DOS took the different path, using '/' for
command-line options and '' as the directory separator.

To liven up matters even more, Linux also chooses to be case sensitive.
What this means that the case, whether in capitals or not, of the
characters becomes very important. So this is not the same as THIS or ThIs
for that matter. This one feature probably causes the most problems for

We now move on to the layout or the directory structure of the Linux
filesystem. Given below is the result of a 'ls -p' in the root directory.

bin/ dev/ home/ lost+found/ proc/ sbin/ usr/
boot/ etc/ lib/ mnt/ root/ tmp/ var/

/sbin - This directory contains all the binaries that are essential to the
working of the system. These include system administration as well as
maintenance and hardware configuration programs. Find lilo, fdisk, init,
ifconfig etc here. These are the essential programs that are required by
all the users. Another directory that contains system binaries is /usr/sbin.
This directory contains other binaries of use to the system administrator.
This is where you will find the network daemons for your system along with
other binaries that only the system administrator has access to, but which are
not required for system maintenance, repair etc.

/bin - In contrast to /sbin, the bin directory contains several useful
commands that are used by both the system administrator as well as
non-privileged users. This directory usually contains the shells like
bash, csh etc. as well as much used commands like cp, mv, rm, cat, ls.
There also is /usr/bin, which contains other user binaries. These binaries
on the other hand are not essential for the user. The binaries in /bin
however, a user cannot do without.

/boot - This directory contains the file as well as the Linux
kernel. Lilo places the boot sector backups in this directory.

/dev - This is a very interesting directory that highlights one important
characteristic of the Linux filesystem - everything is a file or a
directory. Look through this directory and you should see hda1, hda2 etc,
which represent the various partitions on the first master drive of the
system. /dev/cdrom and /dev/fd0 represent your CDROM drive and your floppy
drive. This may seem strange but it will make sense if you compare the
characteristics of files to that of your hardware. Both can be read from
and written to. Take /dev/dsp, for instance. This file represents your
speaker device. So any data written to this file will be re-directed to
your speaker. Try 'cat /etc/lilo.conf > /dev/dsp' and you should hear some
sound on the speaker. That's the sound of your lilo.conf file! Similarly,
sending data to and reading from /dev/ttyS0 ( COM 1 ) will allow you to
communicate with a device attached there - your modem.

/etc - This directory contains all the configuration files for your system.
Your lilo.conf file lies in this directory as does hosts, resolv.conf and
fstab. Under this directory will be X11 sub-directory which contains the
configuration files for X. More importantly, the /etc/rc.d directory
contains the system startup scripts. This is a good directory to backup
often. It will definitely save you a lot of re-configuration later if you
re-install or lose your current installation.

/home - Linux is a multi-user environment so each user is also assigned a
specific directory which is accessible only to them and the system
administrator. These are the user home directories, which can be found
under /home/username. This directory also contains the user specific
settings for programs like IRC, X etc.

/lib - This contains all the shared libraries that are required by system
programs. Windows equivalent to a shared library would be a DLL file.

/lost+found - Linux should always go through a proper shutdown. Sometimes
your system might crash or a power failure might take the machine down.
Either way, at the next boot, a lengthy filesystem check using fsck will
be done. Fsck will go through the system and try to recover any corrupt
files that it finds. The result of this recovery operation will be placed
in this directory. The files recovered are not likely to be complete or
make much sense but there always is a chance that something worthwhile is

/mnt - This is a generic mount point under which you mount your filesystems
or devices. Mounting is the process by which you make a filesystem
available to the system. After mounting your files will be accessible
under the mount-point. This directory usually contains mount points or
sub-directories where you mount your floppy and your CD. You can also
create additional mount-points here if you want. There is no limitation to
creating a mount-point anywhere on your system but convention says that
you do not litter your file system with mount-points.

/opt - This directory contains all the software and add-on packages that
are not part of the default installation. Generally you will find KDE and
StarOffice here. Again, this directory is not used very often as it's
mostly a standard in Unix installations.

/proc - This is a special directory on your system. We have a more detailed
article on this one here.

/root - We talked about user home directories earlier and well this one is
the home directory of the user root. This is not to be confused with the
system root, which is directory at the highest level in the filesystem.

/tmp - This directory contains mostly files that are required temporarily.
Many programs use this to create lock files and for temporary storage of
data. On some systems, this directory is cleared out at boot or at

/usr - This is one of the most important directories in the system as it
contains all the user binaries. X and its supporting libraries can be
found here. User programs like telnet, ftp etc are also placed here.
/usr/doc contains useful system documentation. /usr/src/linux contains the
source code for the Linux kernel.

/var - This directory contains spooling data like mail and also the output
from the printer daemon. The system logs are also kept here in
/var/log/messages. You will also find the database for BIND in /var/named
and for NIS in /var/yp.

This was a short and basic look at the Linux filesystem. You do need to
have at least this basic knowledge of the layout of the filesystem to
fully utilize its potential. One good place to read about the filesystem
is this detailed document at that
specifies the standard structure of the Linux filesystem.

Linux Filesystem Hierarchy Standard
Exploring /proc
Filesystems HOWTO

Thursday, May 6, 2010

Excellent Downloadable eBooks To Teach Yourself Linux

So you have heard of all the advantages and geeky babble about how Linux is better and you have finally decided to try it? Just one thing, you don’t know an awful lot about Linux to get you started. How about some free downloadable ebooks to teach yourself Linux, that you can download today? Would that help?

Free – you ask? Yes, free. Welcome to the world of Linux where things are free both as in free speech and also as in free beer (mostly)!

If you are starting out on your journey towards Linux awesomeness, here are a few free downloadable ebooks to teach yourself Linux that should help you along nicely:

Newbie’s Getting Started Guide to Linux


MakeUseOf’s very own Newbie’s Guide to Linux, tells you how to choose a distribution and then teaches you how to perform a basic Linux install. You can then use the guide to familiarize yourself with the Linux desktop and some basic commands.

Stefan did a great job in keeping it simple and to the point, the way beginners want it. Also don’t forget to check out our other MakeUseOf Manuals.

Introduction to Linux – A Hands on Guide


Takes you from the absolute basics to basics. This hands on guide tells you everything right from logging in, basic file management, backup techniques up to basics of networking. It is what you need if you are having difficulty figuring out how to get to that resume file you saved just now. The guide explains Linux file structure and introduces to basic commands and text editors as well.

GNU/Linux Command line tools Summary


One important aspect of working in Linux is that you have to familiar with the command line. This book shows you how to use the command line in Linux to your advantage. Apart from the ins and outs of the shell, this book also introduces various commands and the situations where you would use them. There are chapters that deal with specific tasks and list various commands you can use to achieve the task. If you can study online, there is another excellent manual you can refer to.

Ubuntu Pocket Guide and Reference


Ubuntu is one of the most popular distributions, new users look up to when trying out Linux. If it is Ubuntu specific information that you are after then you should definitely check out Ubuntu Pocket Guide and Reference. The guide takes you from installing and configuring Ubuntu to adding and managing software and securing your system. A must read book if you use Ubuntu.

Rute User’s Tutorial and Exposition


This one is not for the faint hearted! There is enough Linux juice in this book to keep even the intermediate to advanced users interested. The book begins humbly by presenting the basic commands and tools, however before you know it, you are learning everything from regular expressions to shell scripting to C programming to networking.

There is plenty of great material out there if you are trying to learn Linux, similar to these downloadable ebooks to teach yourself everything you ever wanted to know about Linux. If you have read a book or a tutorial that you found particularly useful, feel free to tell us about it in the comments below.

Wednesday, April 28, 2010

Current and Future Developments in Embedded Mobile Linux

An increasing number of manufacturers are adopting Linux for their mobile phones since it enables them to use the same operating system on a large range of different products. It also gives them greater flexibility in differentiating devices, without being locked into proprietary schemes.

Mobile phones running Linux include
- Motorola A760, A768, A780, and E680
- Panasonic P901i
- NEC N901ic
- Samsung SCH-i519
- Telepong
- Wildseed
- ROAD S101 devices

The Sharp Zaurus PDAs have been leading in the area of handheld Linux devices for many years.

Additional Resources

You can find more information about embedded Linux and Linux for mobile devices, including the latest on Linux gadgets and software applications here.

Comparison with Other Embedded Operating Systems

Compared with other embedded operating systems, like QNX, Windows CE, Embedded NT, or Palm OS, Embedded Linux has the advantages of being Open Source, stable and well supported, having a small footprint (2MB), and requiring no royalty payments.

Embedded Mobile Linux Processors and Vendors

Processor Architectures used with Embedded/Mobile Linux

Besides the ARM processors, embedded Linux has been adapted to a variety of processors, including
- IBM PowerPC embedded processors
- Tensilica’s Xtensa microprocessors
- Intel’s processors for wireless devices
- Freescale's PowerPC and PowerQuicc processors

Embedded Linux Vendors

Organizations developing embedded/mobile Linux products include
- RTLinux
- LynuxWorks
- Wind River
- MontaVista, which has released Mobilinux, the first version of its Linux operating system specifically designed and optimized for mobile phones and wireless devices.

Mobile Linux vs. Standard (x86-based) Linux

The methodical design of Linux, a UNIX-based operating system, made it possible to adapt it to a wide range of computing platforms. Originally developed for Intel 386 processors and their successors, Linux was soon ported to DEC Alpha processor architectures and runs today on many other widely adopted CPUs. Of particular interest in this context are the ARM based architectures, as many embedded systems and mobile devices are powered by ARM processors. Being able to extract the core functionality of Linux and minimize its footprint made it possible to adopt Linux as an open standard for small and inexpensive devices.

Embedded Linux for Mobile Devices

The first operating systems for mobile phones and other mobile consumer electronic devices were custom developed, which means they were expensive to develop and maintain, as all hardware drivers and interfaces had to be written from scratch in a low level programming language.

Soon developers started to look for higher-level approaches that would facilitate re-use of software components. A typical installation of embedded Linux requires only about two megabytes, which was therefore a good candidate for use as operating system of resource limited devices. Furthermore, Linux is Open Source and therefore well suited as basis for standards.

A group of companies interested in the development of Linux products formed The Embedded Linux Consortium (ELC) in order to promote Linux and develop standards for the embedded computing markets. Standards are also developed for managing power consumption of devices, designing user interfaces, and real-time operation of embedded Linux software. One of the results of this effort is the Embedded Linux Consortium Platform Specification (ELCPS).

Power Combination: Mobile Linux and Mobile Java

While Linux is evolving into a major standard for mobile device operating systems, Java is becoming a standard at the software application level. The J2ME/MIDP specifications have been adopted by all major mobile phone manufacturers, which enables software developers to write applications that can be run, without modifications, on all such devices that adhere to these specifications. The MIDP (Mobile Information Device Profile) is comprised of a set of Java APIs, that provides a J2ME (Java 2 Micro Edition) runtime environment for mobile information devices. It standardizes functions such as user interface design, persistent storage, and networking.