Friday, January 29, 2010

Change timezone on Ubuntu Server

In order to change timezone on Ubuntu server I used the following command

sudo dpkg-reconfigure tzdata

Check MySQL version

In order to check MySQL version I used the following SQL query

show variables like 'version';

Craete tar file archive and extract it

To create a tar file archive I used the following command
tar -cvf package.tar folderName

To untar (extract) the file I used the following commnad
tar -xvf package.tar

Monday, January 11, 2010

Format Date String in DOS batch file

To format date in DOS batch file I used the following syntax,

echo %date:~8,2%%date:~3,2%%date:~0,2%

which output 100111 for 11th January 2010.

Thursday, January 07, 2010

Kill all unix processes with name known

In order to kill the process in Unix withe the name of the process I used the following command, where poller is the name of the process

kill -9 `ps -ef | grep poller | grep -v grep | awk '{print $2}'`

Wednesday, January 06, 2010

Set time and date from command line in unix

To set date using command prompt in Unix I used the following command

sudo date MMDDHHMI

where MM is the month, DD is the date, HH is the hour and MI is the minute