user-avatar
Today is Friday
November 22, 2024

Category: tech

December 1, 2009

Get all your Gmail Contacts in Thunderbird Address Book

by viggy — Categories: tech — Tags: , , , , Leave a comment

Thanks to this post, I found a addon of thunderbird which synchronizes all your contacts of gmail with thunderbird address book.

Here is the link for the addon

https://addons.mozilla.org/en-US/thunderbird/addon/7307

November 13, 2009

How To Check Which Software Package Is Using More Space

by viggy — Categories: linux, tech, ubuntu — Tags: , , , , Leave a comment

Courtsey: http://www.unnionline.com/blog/?cat=9

If you’re running out of disk space and you want to quickly see what packages are using the most space on your hard drive, use the following command

dpkg-query –show –showformat=’${Package;-50}t${Installed-Size}n’ | sort -k 2 -n | grep -v deinstall | awk ‘{printf “%.3f MB t %sn”, $2/(1024), $1}’

That will sort the packages by size, putting the largest ones on the bottom. If you only want to see the top few, you can type

tail -n 10

at the end, because in all likeliness you have a *lot* of packages installed

November 12, 2009

a shell script to check if a ipaddress is taken using ping

by viggy — Categories: tech — Tags: , , , Leave a comment

With the help of Abhas Bhaiyya, I could write this shell script which checks if an ipaddress can be pinged.

#!/bin/sh

if [ `ping -c1 192.168.31.31 >/dev/null; echo $?` -eq 1 ]
then
echo “not able to ping”
fi

/dev/null is used here so that the output of the ping command is not compared with 1.
$? gives out the return code of the command.

November 12, 2009

how to get the last argument from the last command in the shell

by viggy — Categories: tech — Tags: , , , , Leave a comment

‘!$’ is the right answer.

For example: $vim test.pl
$chmod +x !$
$./!$

So what is happening above is
first vim test.pl opens a file.
then after you have written a perl script, you would like to make it executable. There is no need for you to specify the file name again. You can just use !$.
In the third command again to execute the file, there is no need to mention the file name again. You just use !$ again.

November 11, 2009

What does ‘+’ in BLOCKS column in partition table output of fdisk command mean?

by viggy — Categories: linux, tech, ubuntu — Tags: , , , Leave a comment

On the printout of a partition table, in the BLOCKS column, several
partition block count have a ‘+’ at the end – some do not. What does
this mean?

It means that the partition does not end on the 1k block boundary.
In other words the partition has an odd number of 512 bytes sectors
allocated. Use “x” command and then “p” to see.

November 10, 2009

Postal to the rescue.

by viggy — Categories: tech — Tags: , , , Leave a comment

Postal is used to benchmark SMTP servers.
I am using it so that I can send mails continously to my test server and hence check if it is working properly. Hence this saves me from the pain of composing mails everytime I do some changes in the server and check if the changes I made is what I intended.

All I have to do is execute one command given below.

postal -m 100 -f test -t 5 192.168.31.100 users_mail

users_mail has the list of all the users in my test server.

November 9, 2009

Using sed

by viggy — Categories: tech — Tags: , , Leave a comment

How to use sed command to remove lines from a file which match a particular pattern.

sed ‘//d’ file-name > tmp

This command will delete all the lines from the file which match the pattern and then store the contents in the ‘tmp’ file.

How to use sed command to substitute strings which match a pattern and then replace it with another string?

sed -e ‘s///’

This command is to match a string and replace it with another string. The new contents of the will be stored in

How to use a pattern matched in sed command also in the replaced string?

Use & to substitute the matched string.

November 3, 2009

one line perl command to get the @INC array

by viggy — Categories: perl, programming, tech — Tags: , Leave a comment

Below is a one line command to display all the entry in @INC array which contains the paths where perl programs looks for perl modules.

perl -e ‘foreach $_ (@INC){ print $_,”n”};’

November 3, 2009

To allow forwarding of a port in the server

by viggy — Categories: tech — Tags: , , , Leave a comment

Well I needed to forward port 587 in my server so that Thunderbird installed in my local desktop could send mails through gmail account.
Here is how I did it.

iptables -I FORWARD -p tcp –dport 587 -j ACCEPT

What the above command does exactly is writes a (-I) inserts a new rule in the FORWARD chain which (-j) ACCEPTs all packets following (-p) tcp protocol and (–dport) destination port 587

October 29, 2009

Fatal error : Call to undefined function: ldap_connect()

by viggy — Categories: drupal, tech, web — Tags: , , , , Leave a comment

I got this error when I was trying to get my drupal installation authenticate using the local ldap directory. Initially, I had thought that I was getting error because of my ldap settings. Then I enabled error reporting on my site, that is when this error was displayed to me.

This error is caused, I suppose due to the missing package php5-ldap in the system. After I installed this package using apt-get and restarted apache2, LDAP authentication wroked fine.