Archive for June, 2008

Mounting ISO file

June 14, 2008

To mount an ISO file use the following command

  mount -F hsfs -o ro `lofiadm -a /path/to/file-name.iso` /path/to/mountpoint

Mounting iso on Mac OSX

hdiutil mount sample.iso

On Redhat …

mount -t iso sample.iso -o loop

“sudo” without password prompt

June 14, 2008

When we use sudo command to run any command with root privilege then it always ask for password, to avoid this run the command ‘visudo’ as root and write this lines after the following line

                       root ALL=(ALL) ALL
                       your_user_name ALL=(ALL) NOPASSWD:ALL

Printing particular line from a file or from std out

June 14, 2008

If you want to see the particular line number of a file (for example line no 10) in standard output, just use the following command

sed -n ‘5 p’ < (file name)

here 5 indicate the line number.

fomatting output with ‘sed’

June 14, 2008

Lets have some pracice with sed…

consider the following lines

64 bytes from tdevi ( icmp_seq=20. time=253. ms
64 bytes from tdevi ( icmp_seq=21. time=251. ms
64 bytes from tdevi ( icmp_seq=22. time=257. ms

I need only the icmp_seq and time field

First only icmp_seq

less ping-ms01.out |sed ‘s/.*://’|sed ‘s/.*q=//’ will result

22. time=257. ms

Then for time

sed ‘s/.\ time=/,/’ will result


Extracting tar ball in solaris

June 12, 2008

gunzip -c Pod-Simple-3.07.tar.gz | tar xf –


gtar zxf Pod-Simple-3.07.tar.gz