Wednesday, October 15, 2008

Openoffice 3.0

Openoffice 3.0 is now available for download.
From the openoffice.org website:

"Apologies - our website is struggling to cope with the unprecedented
demand for the new release 3.0 of OpenOffice.org. The technical teams are
trying to come up with a solution.

Thank you for your patience."

That means so many people in the world is using openoffice that openoffice.org have to increase their servers capacity ;)

Thursday, September 25, 2008

Using find to do operations on multiple files

I learned this technique from my sifoo when he had to change a bunch of html files to unix using dos2unix command. I found that this is very useful and I would like to share it :)

To find files with the extension .html in the current folder and run command dos2unix to all of them:

  • $ find . -type f -name *html -exec dos2unix ’{}’ \;
To see more use of find, refer to find manpage:
  • $ man find

Thursday, September 11, 2008

Send email with attachment from terminal

To be able to do as the above mentioned, a tool named mutt is needed. Mutt is a mail user agent (MUA) and a very excellent one in my opinion. To install mutt:

  • # yum install mutt
To send email, you can use this commands (Choose whichever you like):
  • # echo "your messages" | mail -s "your subject" johndoe@yahoo.com
    • where -s is for subject and johndoe@yahoo.com is your recipient name
  • # echo "your messages" | mutt -s "your subject" johndoe@yahoo.com
    • where -s is for subject and johndoe@yahoo.com is your recipient name
To send email with attachment
  • # echo "your messages" | mutt -s "your subject" -a /path/to/attachment johndoe@yahoo.com
    • where -s is for subject, johndoe@yahoo.com is the recipient name and /path/to/atachment is the path to attachment file
Hope this will be helpful...:)

Tuesday, September 9, 2008

Ubuntu forgotten password

What to do when you forgot your password for your ubuntu machine?? Here are some simple steps on how to change the password using single user mode.

  1. Reboot the machine
  2. When grub is loading, press 'Esc'
  3. Choose 'Ubuntu kernel...........(recovery mode)'
    • Press 'e' to edit the kernel parameter
    • Append 'single init=/bin/bash' to the kernel parameter
  4. Press 'b' to boot from that particular kernel
  5. You will enter single user mode
  6. Your hard drive will be in read-only mode. Remount it in read-write mode
    • # mount -o remount,rw /dev/sda1
  7. Change your passwd
    • # passwd user
  8. Reboot your machine
  9. Access your machine using your new password
Congratulations, you just changed you user password using single user mode

Friday, August 29, 2008

Resizing your xen DomU using LVM

To resize the disk space of a xen DomU that is using Logical Volume Manager(LVM) is very easy. Below is step by step on how to do the resizing process.

  1. Create a new image with the size that you require. Just give any meaningful name to the image. In this case I will use the name extended.img
    • # dd if=/dev/zero of=extended.img bs=1 count=1 seek=20G conv=notrunc
  2. Add the new image to the configuration file of your DomU. In this example, the name of the domU is xen0
    • # vi /etc/xen/xen0
    • Add these line to it
      • disk = [ 'tap:aio:/path/to/xen/xen0.img,xvda,w','file:/path/to/xen/extended.img,xvdb,w' ]
    • Save
  3. Start your domU
    • # xm create xen0
  4. Access your domU
    • # xm console xen0
  5. Once inside, check whether the new image is detected
    • # fdisk -lu
  6. After confirm that your new hard disk image is detected, it is time we have to work on the lvm
    • Create new physical volume (PV) using the new hard disk image
      • # pvcreate -v /dev/xvdb
    • Check that you have successfully added the PV
      • # pvdisplay
    • Extend your existing volume group (VG) to include the new PV
      • # vgextend -v VolGroup00 /dev/xvdb
    • Check that you have successfully add the PV into the VG
      • # vgdisplay
    • Extend your logical volume (LV)
      • # lvextend -L +20G -v /dev/VolGroup00/LogVol00
    • Check that the extension has been added
      • # lvdisplay
    • If all the steps are successfully done, you have to resize the / partition
      • # resize2fs /dev/mapper/VolGroup00-LogVol00
  7. You are done. Check your new hard disk space :)
    • # df -lh