Archive for September, 2007

First Indian football team won Nehru Cup, then Indian Hockey Team won the Asia cup and then it was the turn of Indian cricket team, They won the 20-20 World cup and then Vishwanathan Anand became the World Chess champion. All these 4 big events happened in just in a span of almost one month. Isn’t it the CHAK DE INDIA effect?

August 29, 2007 – Football Nehru Cup, India never reached finals of Nehru cup before, and this time they won this title be defeating Syria by 1-0.

September 9, 2007 – Hockey Asia Cup, India started this tournament with a win of 1-0 on China. Later, India played at its best while thrashing Sri Lanka with 20-0, Thailand with 16-0. In final, they performed superbly and won the title by defeating Korea with 7-2. India ended the tournament with 57 goals and just 5 goals against them without a single defeat. Isn’t it unbelievable?

September 24, 2007 – Cricket 20-20 World Cup, I am a big fan of cricket but due to poor performance of India since last year, i lost interest in cricket and when India was out from ODI world cup 2007 in the first round, i just stopped the watching Indian cricket matches, i thought its very hard for Indian cricket team to come back. But the Indian cricket team proved me (and of course others also) wrong very soon. In 20-20 world cup, they were playing like champions, Sometimes luck also favored them and they WON the 20-20 world cup. They won this title by defeating Pakistan, South Africa, England and our world champion Australia.

September 30, 2007 – Vishwanathan Anand became the World Chess champion, after winning the global tournament in Mexico.

All this happened just after CHAK DE INDIA was released, I think that all the teams must have followed what SRK told in the movie.
“Play for India first, then for the team, if anything is still left then play for yourself”

I hope India will continue this Chak De India effect.




Read Full Post »

Linux Cut command

Cut Command

Divide a file into several parts (columns)

cut [-b] [-c] [-f] list [-n] [-d delim] [-s] [file]


1. Let say you have a file test.txt which has colon(:) seperated data


If you want to print first set of data from each row, you can use cut command as follow:

cut -d”:” -f1 test.txt

If you want to print just columns 1 to 6 of each line (the employee serial numbers), use the -c1-6 flag, as in this command

cut -c1-6 test.txt

Read Full Post »

Linux Tips

Display the top most process utilizing most CPU (top -b 1)
Show the working directory of a process ? (pwdx pid )
Display the parent/child tree of a process ? (ptree pid )
Display the no.of active established connections to localhost ? (netstat -a | grep EST)
How to create null file ? (cat /dev/null > filename1)
Display top ten largest files/directories ? (du -sk * | sort -nr | head)
Display disk usage (du -h)
How to save man pages to a file ? (man | col -b > filename )
Display the files in the directory by file size ? (ls -ltr | sort -nr -k 5)
Display the processes, which are running under yourusername ( ps -aef | grep username)
Display the all files recursively with path under current directory ? ( find . -depth -print)
Display the Disk Usage of file sizes under each directory in currentDirectory ? (du -k . | sort -nr)
List the files in current directory sorted by size ? (ls -l | grep ^- | sort -nr)

Read Full Post »

Today i came across a problem in solaris. The problem was that while starting my application server, it was throwing an error “Address already in use”.

My app server is a java process and there are many other java process which are running on my zone. But the issue is, how may i know that which java process is using that particular port?

I followed following steps:
1. List all the java process running on my zone ( ps -eaf |grep vagrawal| grep java )
2. Go through each java process and check if it using that particular port ( pfiles $pid|grep 1182 )
(here $pid is the process id of the java process and 1182 is the port number of which i am looking for)

Above method works fine but it is bit a long process, as i have to run step 2 for all java processes, so i ran a folowing command on my console:

for pid in `ps -eaf|grep vagrawal|grep java|grep -v grep|awk -F” ” ‘{print $2}’`; do echo ================= $pid >>myfile; pfiles $pid|grep 1182 >>myfile; done

above loop goes through all the java process and write there process IDs in the file ‘myfile’, and i am also checking usage of my port for that particular process (using pfiles) and prints its output in same file.

Finally there would be a single process which would be using that particular port. Now I can find easily that process in ‘myfile’

Now i have process ID of the process which is occupying my port, and i can kill that by kill -9 pid

Read Full Post »