Pages

Sep 19, 2009

How to add route in Linux

To view the current routing table run “route -n

[root@klmppswdr01p ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.41.42.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
10.41.41.0 10.41.42.8 255.255.255.0 UG 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
0.0.0.0 10.41.42.1 0.0.0.0 UG 0 0 0 eth0


To add a route refer to the command below.

"route add -net 10.41.41.0 netmask 255.255.255.0 gw 10.41.42.8"


To delete a route refer to the command below.

"route del -net 10.41.41.0 netmask 255.255.255.0 gw 10.41.42.8"

The routing information above is not persistent across reboots. After a reboot, the routing information will be lost and you need to add them in again.


The routing information above is not persistent across reboots. After a reboot, the routing information will be lost and you need to add them in again.

To make the routing information persistent, add the “route add” line as seen above into the /etc/rc.local file.

Sample /etc/rc.local file.

#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
route add -net 10.41.41.0 netmask 255.255.255.0 gw 10.41.42.8


Sep 11, 2009

Linux File Structure



For those of you coming from windows backgrounds, the way the linux filesystem is laid out may seem confusing at first glance…. but that is where this article comes in !

The first thing you should know when working with linux, is that everything is treated as either a file or directory. Yeap thats right, even hardware is considered a file by linux, and, speaking of hardware… all your hardware devices are located in the /dev directory, but more on that later.

Another thing that confuses windows users, is the fact that linux dosen’t use drive letters to distinguish between different partitions and devices. that is to say in linux, the “root” of your filesystem is / whereas in windows it would most probably be C:\ . Drives in linux are “mounted” to directories where their data can then be accessed, so for instance, if you needed to use your thumbdrive, you would plug it into your computer, and then mount it using the “mount” command, which specifies the path to the device ( something like /dev/sdb or /dev/sdc ) and the directory to mount it to (usually /mnt or /media), then you can happily access your drive from the /mnt or /media folder.

Sounds strange right? well yes it does if you come from a windows environment, where the entire operating system is consolidated onto a single drive. However, with linux and the ability to mount devices as directories, it gives the end user much greater flexibility in splitting up their operating system over several drives or partitions.

to understand what I mean when I say that this approach in mounting drives grants flexibility, I must first explain the different folders in linux and what they store

The graphic above shows the linux filesystem hierarchy, now will explain in a bit more detail what each folder contains.

/ this is the root folder, all other folders come under root.. think of it as C:\ in a Windows context.

/bin this folder contains all the user-essential binaries (programs) that are needed to administer and run your linux system… delete this folder and your system is broken.

/boot as the name suggests, this folder contains configuration files and other necessary files that are needed by the bootloader

/dev this folder contains device files (remember, these files represent physical devices, so be careful when working with them)

/etc this folder contains all the configuration files used by the system, you can also start and stop services (daemons ) from here

/home this folder contains the home folders of all the normal (non – root ) users on the system .. think of it as my documents in windows

/lib this folder contains software libraries

/media this is a mount point for removable devices… this is where you would usually mount your thumbdrives … etc

/mnt this is a temporary mount point

/opt this folder contains add on software (extra software)

/sbin this folder contains binaries that can only be run as the root user (”superuser”)

/tmp this folder contains temporary files that are erased upon reboot

/usr this folder and its subfolders contains user installed programs and utilities and libraries

/var this folder contains files that change alot (”Variable files”)

/root this folder contians the root user’s files

/proc this is a psuedo folder, that contains information about the linux kernel and hardware that is updated in realtime.

Now back to how mounting grants flexibility…

you see how the different folders all contain parts of the operating system? well we can actually mount a seperate hard drive for each of this folders. for example, your /home folder can be put on another harddrive than your / which means that you can easily recover your personal files if the harddrive on / fails because the harddrive mounted to your /home folder is seperate from the one that is mounted to your /

So there you have it, you now know a little bit more about the nuts and bolts of linux based operating systems.

Jul 27, 2009

Linux Keybroad Shortcut





KEYBOARD SHORTCUT KEYS


CTRL + B Moves the cursor backward one character.
CTRL + C Cancels the currently running command.
CTRL + D Logs out of the current session.
CTRL + F Moves the cursor forward one character.
CTRL + H Erase one character. Similar to pressing backspace.
CTRL + P Paste previous line and/or lines.
CTRL + S Stops all output on screen
CTRL + Q Turns all output stopped on screen back on
CTRL + U Erases the complete line.
CTRL + W Deletes the last word typed in. For example, if you typed 'mv file1 file2' this shortcut would delete file2.
CTRL + Z Cancels current operation, moves back a directory and/or takes the current operation and moves it to the background. See bg command for additional information about background.


More Helpful Shortcut

~ Moves to the user's home directory.
!! Repeats the line last entered at the shell.
!$ Repeats the last argument for the command last used.
reset Resets the terminal if terminal screen is not displaying correctly.
shutdown -h now Remotely or locally shuts the system down.

Jul 2, 2009

SquirrelMail replaces Microsoft Outlook in the office of the Indian Prime Minister


I have found the following interesting news from SquirrelMail.org’s website



(http://www.squirrelmail.org/index.php)
is enough to open eyes and minds of the government of under-developed countries (as ours), and a signal to act accordingly.

Here is the text directly from that site, from their News section.
NEWS: SquirrelMail replaces Microsoft Outlook in the office of the Indian Prime Minister

Mar 25, 2009 by Paul Lesniewski

Several news outlets (Techgoss, infopackets, The Register, The Times of India, etc.) are reporting that after a virus prevented email retrieval for three months in the office of the Prime Minister of India, SquirrelMail was chosen as part of a replacement system that had previously been based on Microsoft products. This surely means that several other Open Source products were included in the switch, and we applaud both the Office Of the Prime Minister and its technology consultants who made the switch to Open Source Software

Uninstalling Linux

Hi,

In this HOW-TO i'm going to try to explain how to uninstall linux without messing up your windows partition. I feel this is a area that isn't really touched upon that much and most newbies need help with it. I know when I was a noob I didn't like linux because I hadn't knew how to uninstall it. But now I feel I know enough to write a tutorial on how to do it and explain the steps.


1. Removing Your Disto

The easiest way uninstall linux is probably from a Windows XP CD. Once you boot from the CD follow the instructions until you get to the part where you see all the partitions on your hard drive. You must delete all your linux partitions. The primary partitions you'll probably see are

linux ext3, linux ext2, linux swap.

You should delete all these partitions to remove your distro.


2. Fixing your Master Boot Record

Most people know how to uninstall their distro. But afterwards their presented with a black screen and grub asking for input

grub>

or something similar to that. This is were I got totally confused when I was first starting linux. I had no idea what to do so I just re-installed my distro, which actually fixed the problem but I wanted linux totally gone. Enough about me let's get back uninstalling linux. Boot off the Windows XP CD and after windows loads type r to get to the Recovery Console. Once you in the the Recovery Console you'll probably be prompted to type the administrator user name and password. I ususally just put admin as the user name and nothing as the password and it usually works. But that is just my settings your might be different, but usually admin and no password works fine . Now were in recovery console all we have to do is type:

fixmbr

this command will re-write the Master Boot Record, therefore removing Grub.


3. Finished

Now just type shutdown -r this will restart the computer. Remove the Windows XP CD. Now when the computer starts you should be greeted with the all familiar Windows Startup Screen.