Saturday, October 11, 2014

Installing Arch Linux

Download latest ISO from & burn it to a CD
If using in VM then boot from ISO directly.

For detailed guide refer official Installation guide -

Note - Internet connectivity required for installation.

After booting the installation image, the following steps are required to initialize the installation process.

Partition the disks via fdisk or cfdisk & then format the partitions using mkfs.ext3, mkfs.ext4 & mkswap command appropriately.

    For demonstration I have created the below partitions of an 100 GB HDD assuming it as /dev/sda
        File System        Type         Partition        Size
        /dev/sda1               ext3          /boot                 200 MB
        /dev/sda2               swap         swap                2 GB
        /dev/sda3               ext4          /home               50 GB
        /dev/sda4               ext4          /                       47 GB
Mount the root partitions on /mnt & rest of the partitions under that

        File System            Mounted on
        /dev/sda4                  /mnt
        /dev/sda1                  /mnt/boot
        /dev/sda3                  /mnt/home
        Activate swap partition - swapon /dev/sda2

# Install the base packages

    pacstrap /mnt base
# Generate an fstab file

    genfstab -p /mnt
# Change root to new system

    arch-chroot /mnt
# Set the hostname (in the below command replace example_hostname with your actual hostname)

    echo example_hostname /etc/hostname
# Set the time zone:

    ln -sf /usr/share/zoneinfo/zone/subzone /etc/localtime

# Uncomment the needed locales in /etc/locale.gen, then generate them with:


# Create a new initial RAM disk

    mkinitcpio -p linux

# Set the root password:

# Install bootloader

    pacman -S grub-bios
    grub-install --target=i386-pc --recheck /dev/sda
    grub-mkconfig -o /boot/grub/grub.cfg
# Exit from chroot, reboot the System

# Enjoy minimal Arch Linux now.

Friday, April 22, 2011

Script to find sum of a word in numbers

Attitude = 100% , Usually we find this in lot of forums or mailing lists.
To calculate this in Linux the below script can be used.

Pass the word as first argument to calculate its sum in words.


for alpha in {a..z}
let $alpha=$initial
initial=`expr $initial + 1`
while [ $base -lt $length ]
semi=$(($(echo ${word:base:offset})))
let final=`expr $final + $semi`
let base++

echo "Numeric value of $word is $final"

Sunday, April 25, 2010

Create local YUM repository from iso

To Create a local yum repository a separate tool createrepo is required.
To install createrepo, mount the iso and type the following commands...
# mkdir -p /mnt/repo/{1,centoscd}
# mount  -o loop /path/to/centos.iso /mnt/repo/1
# rpm -ivh /mnt/repo/1/CentOS/createrepo*.rpm
Now copy the contents from iso to /mnt/repo/centoscd
# cp -rpf /mnt/repo/1/* /mnt/repo/centoscd/
Now create the repository
# cd /mnt/repo
# createrepo .
To clean existing repo cache enter
# yum clean all
Create config file
Add the following text in /etc/yum.repos.d/localiso.repo
Before installing packages GPG key needs to be imported
# rpm --import /mnt/repo/centoscd/RPM-GPG-KEY-CentOS*
Now use yum command to install packages
# yum install package-name

Thursday, August 27, 2009

List only directories in Linux

There are many ways to list only directories in a linux machine.

1) ls -ld /*

2) tree -di

3) ls -l | grep '^d' | awk '{print $8}' ### for Red Hat put $9 & for OpenSuse put $8

SVN book online

This is a place to read HTML and PDF versions of the book: