Combobox On change

If you need to get a value for the selected item in a combo box you can use the following function :


if you need the value then just replace text with value .

For example, if you want to redirect the page based on combobox selection :


Force Install CPAN Module in Linux from CLI

Force Install CPAN Module

perl -MCPAN -e “CPAN::Shell->force(qw(install HTTP::Cookies));”

Changing the password hashing algorithm to sha-512

change password hashing algorithm to sha-512

# authconfig –test | grep hashing
# authconfig –passalgo=sha512 –update

Redirecting Ports in Iptables

Redirect ports in iptables

iptables -t nat -A PREROUTING -i eth0 -p tcp –dport $srcPortNumber -j REDIRECT –to-port $dstPortNumbe

Installing Perl Modules

Its convenient to install perl modules from command line.

#perl -MCPAN -e shell 
cpan> install PACKAGE NAME


cpan> install HTML::Template

Adding Multiple IP Address to A NIC Card

It is possible to bind more than one ip address on a single network interface card in linux.

copy your existing network card  configuration file as shown:

#cd /etc/sysconfig/network-scripts
#cp ifcfg-eth0 ifcfg-eth0:1

>>ifcfg-eth0 looks like this :

# File: ifcfg-eth0

Change the device name and the ip address parameters

File : ifcfg-eth0:1

#save the fiel and then restart the network

#service network restart

How to retrieve file

You can retrieve file by issuing the following command

dig . ns >

or download from this location :

Grub reinstall in rescue mode

You can re-install grub boot loader in rescue mode by issuing the following command :

#grub-install /dev/sda1 or hda1 ( based on your boot partition)

if it is scsi drive it would be sda and hda if it is ide drive.

If you get something like this :

” Error /dev/hdx or sdx does not have any corresponding bios drive ”  then issue the following command :

#grub-install –recheck /dev/sda or hda

Hope it helps

Save File as in VI Editor

You can save file as another file in vi editor after you make changes to the current file, so that you can quit without saving and still retain the changes in another file.

:w! newfile.txt


:w! /var/newfile.txt


Introduction to String Processing

Introduction to string Processing


Head and tail command are used to view the first and last few lines of a file respectively.

By default these commands generate 10 number of lines.

# head /etc/passwd (shows first 10 lines)

# tail /etc/passwd (shows last 10 lines)

One very handful command to monitor log messages

#tail -f /var/log/messages  (this is used to see the online activities)

wc: Word count

This command is used to count number of lines, words or characters in a file

Syntax: wc <option> filename

options: -l counts number of lines

-w counts number of words

-c counts number of characters

# wc -wlc *

Cut: cut command cut the specified field from the file of known formats or to cut first few characters

#cut <option> <file name>

options:  d -delimiter or field separator

-f{number} -field number

-c -to cut the characters

#cut -d: -f1 /etc/passwd (shows only the first field of /etc/passwd’s contents

#cut -d: -f1-3 /etc/passwd (shows only first second and third fields of /etc/passwd contents)

#cut -c1-10 /etc/passwd (shows first 10 characters of file’s line)


sorting is the arrangement of data/information in increasing (ascending) or decreasing(descending) pattern.

#sort <options> file name

options: -r -reverse order

-n -numeric order

-t -as field separator, delimiter

-k position

-u unique sort

#sort /etc/passwd

#sort -r /etc/passwd

#cut -d:-f7 /etc/passwd|sort -u

#sort -t: -K1 /etc/passwd

Uniq: uniq moves the duplication and returns only the unique items.

# cut -d -f7 /etc/passwd|uniq -c (also counts number of counts for the item)