Friday, May 23, 2008

Enabling Hibernate on Linux

Yesterday, I was thinking to enable hibernate on
my HP-Compaq nc-6400 laptop.
Some prerequisites for enabling hibernate on Linux:

(i). ACPI should be enabled in Linux kernel.
I have compiled kernel

(ii) Go to KDE Control Center > Power Control
> Laptop Battery. Then select 'ACPI Config',
click 'Setup Helper Application'. If ACPI
is supported on your PC, you can see that
check boxes are enabled.

(iii) kpowersaved daemon should be installed.

(iv) You should have swap partition >= RAM on your

I did not have the swap partition. :( Then I thought
to create it. Because swap file cannot act as resume
device. i.e. At the boot time kernel should know the
resume device before file system.

How did I create swap partition? Following are the

(a) I created 1 GB partition /dev/sda3 from /dev/sda2
using gparted.

(b) I formatted it and made swap.

# mkswap /dev/sda3

(c) To mount it (as swap) automatically at boot time,
it created following entry in /etc/fstab.

/dev/sda3 swap swap defaults 0 0

(d) I then modified /boot/grub/menu.lst , to make /dev/sda3
as resume device.

I changed booting kernel line from
kernel /boot/vmlinuz- root=/dev/sda1 ro
kernel /boot/vmlinuz- root=/dev/sda1 ro resume=/dev/sda3

(e) Then I rebooted the kernel with resume device. Now I
can hibernate (Suspend to disk) my laptop, using kpowersave
available in KDE tray.

Wednesday, May 21, 2008

Viewing CD/DVD Image (.iso) File Contents

If you want to view contents of ISO images of CD/DVD
(say xyz.iso in your home directory), you can use mount command.

# mkdir /mnt/cd

# mount -o loop ~/xyz.iso /mnt/cd

Now you can go to /mnt/cd and view the contents of the iso file.

Wednesday, May 14, 2008

Typing Error Correction at Command Line

Open your Bash Resource Config file

$ vim ~/.bashrc

alias vmi='vim'
alias mvi='vim'
$ mvi ~/.bashrc
will open .bashrc

Wednesday, May 7, 2008

Creation of Tar and Compressed file (Tar-ball) in one go

Suppose you want to create tar ball of directory xyz in your home directory.

$ cd ~

$ tar -zcvf xyz.tar.gz xyz/


$ tar -jcvf xyz.tar.bz2 xyz/

If you want to untar an unzip at one go, go to
the desired output directory.

$ cd ~

$ tar -zxvf xyz.tar.gz


$ tar -jxvf xyz.tar.bz2