Saturday, February 18, 2006

Networking Configuration for all!!!

Let me explain each term which you might face during configuring Netowork settings:

Network interface cards (NICs) are called eth0, eth1 etc in Linux

IP ADDRESS is a number used to uniquely identify a network interface.

DEFAULT GATEWAY address is the IP address of the device connected to the internet eg. your router, or PC running internet connection sharing (ICS). The address to use is the one allocated to the interface connected to your internal network.

NAMESERVER address is the IP address of your internet service providers (ISP) nameserver.

HOSTNAME is a unique name for your computer.

You will need to be root (administrator) to edit the files here.
To sign on as root - type su in a terminal (console), press enter followed by your root password

The basic commands used in Linux are common to every distro:
ifconfig - Configures and displays the IP parameters of a network interface
route - Used to set static routes and view the routing table
hostname - Necessary for viewing and setting the hostname of the system
netstat - Flexible command for viewing information about network statistics,current connections, listeing ports
arp - Shows and manages the arp table

Every distro has its own configuration tool that operate on variously defined configuration files. Some of them are common: /etc/resolv.conf, /etc/nsswitch.conf, /etc/hosts, /etc/services, /etc/protocols

Some, typically the ones where are defined IP addresses and routes, change. Here are some relevant files for various distro, their syntax may vary according the scripts used to handle them:

/etc/network/interfaces - Interfaces and network parameters

vRedHat Graphical interface: redhat-config-network
/etc/sysconfig/network-scripts/ifcfg/* - Configuration files for each interface. The same file can be found, divided per profile, in /etc/sysconfig/networking/devices/*
/etc/sysconfig/network - Hostname, default gateway, general configuration
/etc/sysconfig/static-routes - Static routes (if any)

SlackWare Graphical interface: Netconfig
/etc/rc.d/rc.inet1 - IP and network parameters
/etc/rc.d/rc.inet2 - Network Services configuration

Mandrake Graphical interface: Drakconnect
/etc/sysconfig/network-scripts/ifcfg/* - Configuration files for each interface. The same file can be found, divided per profile, in /etc/sysconfig/networking/devices/*
/etc/sysconfig/network - Hostname, default gateway, general configuration
/etc/sysconfig/static-routes - Static routes (if any)

/etc/conf.d/net - Ip network and interfaces parameters
/etc/conf.d/routes - Static routes
/sbin/ifcofig - To see all the settings.

SUSE Graphical interface: Yest2
/etc/sysconfig/network/ifcfg/* - Configuration files for each interface.
/etc/sysconfig/network/config - General network configuration.
/etc/sysconfig/network/routes - Configuring IP Routes
Checking the Network Settings:
/etc/HOSTNAME -Contains the hostname of the system, used by various startup scripts.
/etc/hosts -As in most Unixes, in this file you can statically assign IP addresses to host names.
/etc/networks - for IP networks.
/etc/resolv.conf - The resolver by default first checks this file, before querying the DNS servers.


You can mail me personally at and can visit website which is daily updated by me or

Wednesday, February 15, 2006

Installing Software in Linux

Linux usually complies the code to install a software. But to save time of the user there are also some pre build packages available called binary files (.bin).They are pre compiled and takes lesser time to get installed.
If you want to install from source code then you can find the tarball (zipped) of those softwares. So first we need to unzip that using command "$tar -xvzpf or tar -xvjpf". We will find a configure file in that directory. Run that configure file and then to complile we need to use "make && make install" command.

RPM (RPM Package Manager)
A RPM package contains a library of files with the description of the location where the files have to be copied. It also contains a general description of the package. An other interesting characteristic of RPM is that he checks for dependencies.

The command rpm (Install RPM package using konsole)

* To install sanjay.rpm, type
rpm -ivh sanjay.rpm
*Remeber it will install the package not upgrade the package.

* To uninstall the package sanjay, type
rpm -e sanjay

* To query information about the package sanjay (already installed), type
rpm -qi sanjay

* To query information about the package file sanjay.rpm, type
rpm -qip sanjay.rpm

* To query the file listing in the package sanjay, if already installed, type
rpm -ql sanjay

* To query the file listing in the package file sanjay.rpm, type
rpm -qlp sanjay.rpm

* To update the package sanjay, type
rpm -U sanjay.rpm

* To identify the package whose the file sanjayfile is belonging, type
rpm -qf sanjayfile

* The one which always works (90%case)
rpm -Uvh sanjay.rpm

Tar.gz Package:

An archiving program designed to store and extract files from an archive file known as a tarfile

* You will basically find two type of tar files tar.gz and tar.gz2

* To unzip tar.gz we can use
tar -xvzpf filename.tar.gz

* To unzip tar.gz2 we can use
tar -jxvf filename.tar.gz2

* After that a directory will be formed in which you will find a file named "configure". Now you need to compile that file. you can compile it using the command


* After compiling (make) you need to install that we can do that using command

make install

* So in short we need to do as following

tar -xvzpf filename.tar
cd filename
make install

* This will work for most of the cases

You can mail me personally at and can visit website which is daily updated by me or

Viewing and Editing Files in Linux

You can use both GUI based and command line based editior.

Some GUI based popular editors are :
1) Kate : Heavy but ithas a lot of features.I prefer to use this one for any long code.
2) Kwrite :Light (uses less reqources than Kate)
3) Kedit : Very light Editor which is good from small programs only.Less feautred than Kate.

There are varous command line editior.Some of the most popular one are :
1) VIM editior
2) PICO editor
3) Emacs editor

I prefer to use VIM over these editors though all are equally good editors.

Please go through the documentation of each editor if you want to know more:
$man vim
$man pico
$man emacs

Commands for viewing and editing:
cat filename Dump a file to the screen in ascii.
more filename Progressively dump a file to the screen: ENTER = one line down
SPACEBAR page down q=quit
less filename Like more, but you can use Page-Up too. Not on all systems.
vim filename Edit a file using the vi editor. All UNIX systems will have vi in some form.
emacs filename Edit a file using the emacs editor. Not all systems will have emacs.
head filename Show the first few lines of a file.
head -n filename Show the first n lines of a file.
tail filename Show the last few lines of a file.
tail -n filename Show the last n lines of a file.

Something about vim editor:
1) Opening the file ==> vim
2) Writting in file ==> press " I "
3) Removing whole line ==> ESC then Press " DD " (double d)
4) Saving the file ==> ESC then " :wq "
5) Saving without changing ==> ESC then " :q! "
6) Closing a file ==> ESC then " :q "
7) Searching in a file ==> ESC then "/word"

You can mail me personally at and can visit website which is daily updated by me or

11 Basic Commands in Linux

These are the commands which you have to know in order to be basically functional with a shell (command line):

List directory contents.

ls -l long listing with dates and permissions

ls -a list all, including hidden files (hidden files start with a period)


Change directory.

cd - change to previous directory

cd ~ change to home directory

cd .. change to parent directory


Print current (working) directory.


Copy file(s).

cp -r somedir somedest Copy recursively (directory and all contents)


Move (or rename) a file (or directory)


Delete (remove) a file.

rm -r somedir Delete recursively (directory and all contents)

rm -ri somedir Delete recursively, but prompt before each removal

rm -rf somedir Delete recursively, never prompt


Create directory.


Remove (empty) directory.


Print file contents (to console).


Scroll through file contents, one page at a time.

SPACEBAR to advance a page, B to go back a page, Q to quit, /pattern to search for pattern


Close shell. If this is your login shell, you will log out.

Basic FileSystem in Linux

While switching from windows to linux you will notice a very different kind of filesystem in Linux.

No Partion in Linux
In windows you have various partitions like c:, d:, e: like that and then we save our directories/files in thaose partitions.But in Linux we have only one partition called ROOT (denoted as '/'). Linux places everything in that root partition.

Mounting in Linux
You might be thinking that how do we access windows partition from linux when we have only one partition. Ofcourse you can access. You just have to mount the various partitions into root directory (I will explain it soon).
Widows detect various partition during booting but in linux we need to mount all those partition then only it can be accessed. Today almost all the linux detect partition during booting and mount them but if you add some more partition after installation of linux you need to do that manually.

One very important difference is that linux is "CASE SENSITIVE" but windows don't. Like if you have to access a directory of name "Movies" in /usr/home then you need to write /usr/home/Movies not /usr/home/movies. It wont work in linux. But windows is not case sensitive so it's fine with it.

Now come to the file structures:

You can see all the directories in '/' by typing 'ls' or 'ls -p' or 'ls -l'
sk / $ ls
bin dev home mnt proc sbin sys usr windows
boot etc lib opt root suse tmp var
sk / # ls -l
total 23
drwxr-xr-x 2 root root 3472 Jan 3 20:47 bin
drwxr-xr-x 4 root root 1024 Feb 8 07:28 boot
drwxr-xr-x 19 root root 30600 Feb 13 22:19 dev
drwxr-xr-x 60 root root 3672 Feb 13 22:19 etc
drwxr-xr-x 4 root root 120 Oct 5 19:18 home
drwxr-xr-x 7 root root 3840 Jan 3 20:41 lib
drwxrwxrwx 4 root root 120 Jul 26 2005 mnt
drwxr-xr-x 6 root root 200 Jan 19 15:41 opt
dr-xr-xr-x 95 root root 0 Feb 13 22:18 proc
drwx------ 17 root root 1168 Feb 15 23:29 root
drwxr-xr-x 2 root root 3864 Jan 3 20:47 sbin
drwxr-xr-x 23 root root 560 Feb 8 07:32 suse
drwxr-xr-x 10 root root 0 Feb 13 22:18 sys
drwxrwxrwt 33 root root 7360 Feb 15 23:28 tmp
drwxr-xr-x 15 root root 464 Oct 4 10:12 usr
drwxr-xr-x 13 root root 360 Feb 6 07:24 var
drwxrwxrwx 8 root root 192 Oct 4 18:56 windows

//Write up source : by Mayank Sarup

Lets describe each filesystem:

/sbin/ -
==> Contains all the system binaries that are required to run OS.
==> This includes : Maninatainace hardaware configuration,system programs.
==> There is also a "/usr/sbin/" : Contains other binaries of system admin like network daemon but binaries are not used by system admin for mainatainace,rapair.

/bin/ -
==> Contains all the commands used by both system admin and users.For example: cp, mv, cat, rm etc
==> There is also a /usr/bin/: It contains all user binaries.

/boot/ -
==> Contains the file as well as the Linux kernel.
==> Grub/lilo configuration files is also there.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 gaim,firefox, etc
==> This is same as we have different users in windows.

/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 recovered.

/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/ -
==> The /proc directory contains virtual files that are windows into the current state of the running Linux kernel. This allows the user to peer into a vast array of information, effectively providing them with the kernel's point-of-view within the system. In addition, the user can use the /proc directory to communicate particular configuration changes to the kernel.
==>Viewing Virtual Files :
$cat cat /proc/iomem
$cat /proc/cpuinfo

/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 shutdown.

/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.

You can mail me personally at and can visit website which is daily updated by me or

Monday, February 13, 2006

Learn Linux in Brief

Its really tough to make someone understand about each and evrything in linux. So, I just go in the way, I learnt about linux.

Lets broadly describe the linux system in two parts:
1) Internal System : Consist of kernels,how it works etc. Basically what we dont see.
2) External System : Consist of Filesystem,basic commands,installing,uninstalling etc. Basically,What we see.

First of all we will learn about the external linux system then we will move to internal systems because at this point of time you will find a bit difficult to understand some technical terms which are basically used to explain the internal system. Lets begin with the external (whatever we see/use) system of linux.

External System of Linux:
Lets learn about linux in three levels.Lets call it a BASIC, AVERAGE and ADVANCE level. So if you are newbie you should start with Basic level.


1) File Hierarchy in Linux.
2) Using the command line.
3) Viewing and Editing Files.
4) Installing and Uninstalling a software.
5) Basic Softwares List.
6) Playing audio and video files.
7) Setting up internet,LAN,chatting etc.
8) Look and Feel (Appearance)
9) Users and Permissions.
10)Running Java, C, C++ programs.
11)Changing User login and password.
12)Accessing Windows/UNIX from UNIX/Windows.
13)Process Manager (same as task manager).
14)Basic Problem faced by users.

If you have learnt all these things then CONGRATS!! you are become a user of Linux though you still have a lot of things to learn in linux.Now you might get the feel of linux. The feel of freedom or changing anything you wish. Nou you can change anything you wish.

Now its turn to learn a bit more about linux and became a step forward than others. After this level you can atleast fix some of the problems usually faced by you or your friends.

According to me "The best way to learn is to help others with whatever you have."


1) PATH Variables
2) Konsole Look and Feel
3) Mounting and Unmouting Devices.
4) Secure Shell (SSH)
5) Setting up FTP servers
6) Running Servers (PHP,Apache,JSP etc)
7) Mapped Network Drive - Windows Shares - NFS.
8) Grub/Bootloader fixing.
9) Keyboard map
10) Sound Problems
11) Drivers Installation
12) Hard Disk operation.
13) Installing Printer.
14) CD Writing on Linux.
15) Shell Variables and Customization.
16) Getting X to Start on Boot
17) Bash Programming

This is not the end but just a starting towards the linux. It is very tough to know about each and every thing in linux because there is a lot to learn but time is less. If you have reached up to this stage you dont need any newbie guindance but for completeness I am describing all these things to you. As myself are not much familiar with all the things in advance level so its better if you yourself search on internet. I included information about the website which provides information about linux programming etc.


1) Linux Programming
2) Develop GNU/Linux software.
3) Write codes for drivers.
4) Write more sophisticated programs with features such as multiprocessing, multi-threading, interprocess communication, and interaction with hardware devices.

My next topic after finishinf "Learn Linux in brief" will be "How linux works?"

You can mail me personally at and can visit website which is daily updated by me or

Understanding SWAP (virtual memory)

Swap space is a portion of a hard disk drive (HDD) that is used for virtual memory.

Virtual memory is the use of space on a HDD to simulate additional main memory. Memory is used to hold portions of the operating system, programs and data that are currently in use or that are frequently used. Physically, main memory (also referred to as primary memory) consists of random access memory (RAM) chips that are combined into modules which, in turn, are inserted into slots on the motherboard (i.e., the main circuit board) on a computer. The times required to access different addresses (i.e., locations) in RAM are extremely short and nearly equal, in contrast to the longer and varying times required for accessing locations on the HDD and other storage devices.

In order to free up space in memory, an operating system with a virtual memory capability transfers data that is not immediately needed from memory to the HDD; when that data is needed again, it is copied back into memory. That is, when all of the RAM is being used (e.g., if there are many programs open simultaneously or if one very large program is in use), a computer with virtual memory enabled will swap data to the HDD and back to memory as needed, thus, in effect, increasing the total system memory.
It is generally recommended that for maximum system efficiency the swap space be twice the size of the main memory. This is true even for systems with large memory capacities, such a a gigabyte or more. Swap space is usually a dedicated partition (i.e., a logically independent section of a HDD) that is created during the installation of the operating system. Such a partition is also referred to as a swap partition. However, swap space can also be a special file.

Although it is generally preferable to use a swap partition rather than a file, sometimes it is not practical to add or expand a partition when the amount of RAM is being increased. In such case, a new swap file can be created with the mkswap command.


Linux Downloading Information

  • Number of Cd's : 5 (five)
  • Download the x86 architechture iso images for 32 bit processor.
  • Download x-86-64 for 64 bit processors.
  • All the .rpm files (prebuilt package) are also available there .If you find some problem during installation and some packages are not installed then you can also download the source file (.rpm) and install them manually.

MANDRAKE (Mandriva):
  • Number of CD: 3

  • Number of CD's : 1 Install CD
  • You will find two kind of CD : Install and Live
  • Install CD: Full Installation Using CD.
  • Live CD :Installation through Internet.

  • Number of CD's : 1
  • I will suggest to use KUBUNTU over UBUNTU because KUBUNTU runs on KDE but UBUNTU hav GENOME environment.Though both are equally good but It is just the case I prefer to use KDE over genome.

  • Its better if you use live CD for installation because it gets updated very frequently.
  • Ultimate Documentation.Read it once
You can mail me personally at and can visit website which is daily updated by me or

Sunday, February 12, 2006


Linux comes in various dirtibution (slang : 'distro').You can watch the rating of distro at You can get all information like downloading mirrors,documentation,forums etc from that website.There are about 100 distros informations with all sorts of statistics.

Steps before installation:
1) Download the CD's (ISO image) of the distros.
2) Burn those ISO image.
3) Go to their documentation website (you can get information about the installation from distros home page).
4) Start the installation.

During Installation you might learn some new terms like SWAP,Partioning,Bootloader,GRUB,LILO etc.I know, you know about these terms but let me explain it for those who are not familiar.

==> KDE and GENOME :
These are just "Free Software graphical desktop environment for Linux". KDE stands for "K Desktop Environment". Both are equally featured but still most of the guys prefer to use KDE. So if during installation control center (YAST in Suse) ask for choosing one of these choose KDE (or genome based on your choice).

==> md5 :
In linux, Its a way to check that if CD you have downloded is correct or not. All cd's are automatically checked during installation using md5. It is the surity that it contains all the files and folders which is neede during installation.
Basically it is hashing technique that creates 128-bit message digest.Name comes from the same "message digest".

==> SWAP :
Swap space is a portion of a hard disk drive (HDD) that is used for virtual memory. Keep it about 200-250 MB.

==> Mounting:
A file system can be "mounted" on your Linux system interactively or automatically at startup. Then the file system is just as accessible as any other file system on your computer.
e.g "/hda/dev12 is mounted on /windows/C" means that "You can now access /hda/dev12 (part of hardisk) from /windows/C".

==> Bootloader:
A small program that loads the operating system into the computer's memory when the system is booted and also starts the operating system.
Basically it gives you choices during startup of computer to which OS to boot.

GRUB/LILO : GRand Unified Bootloader is a multiboot boot loader which is most commonly used to allow dual-booting of two or more operating systems installed on a single computer.Silimar is the LILO only GUI is changed. LILO is more interactive and look beautiful.

==> YAST:
YAST is nothing but CONTROL CENTER in SUSE.

==> root:
Its the "superuser" in linux,which has all sorts of permission.You need to set the root password for root.

It can be accessed by using 'su' keyword.
$su -
$password: ********
$You are now working as root.

Better follow the instruction on internet on their official website than on anyother website while installing any distro because some information might be escaped on other websites.

As a newbie I would suggest you to use "SUSE" or "Mandrake" because these distros are very easy to use and very much USER FRIENDLY.

I will soon explain what distro has what special properties. Just keep on updating yourself.

You can mail me personally at and can visit website which is daily updated by me or