Friday, June 15, 2012

HowTo.. ?

A collection of some important "HowTo"s that I have come across..

Hope to periodically update the list as I get to know of a new "HowTo" ..



Mount a remote samba server shared directory in Linux (Ubuntu)

      $  mount -t cifs //10.2.5.5/shared -o username=un,password=pw /test


Extract a "tar.gz" file in Linux
    
     $ tar -xzf tar-file-name.tar.gz
  • tar - the tar command.
  • x - extract the archive.
  • z - uncompress the archive using gzip.
  • f - use archive file.
  • tar-file-name.tar.gz - the name of the tar.gz to create.
The tar command will extract all the files/folders in the archive to the current directory. 

Create a "tar.gz" file in Linux
    
     $ tar -czf new-tar-file-name.tar.gz file1 file2 folder1 folder2
  • tar - the tar command.
  • c - create new archive.
  • z - compress the archive using gzip.
  • f - use archive file.
  • new-tar-file-name.tar.gz - the name of the tar.gz to create.
  • file-or-folder-to-archive - the name of the folder we want to archive.

Mounting and un-mounting Qemu image


nbddevice="/dev/nbd2"
nbdmount="/dev/nbd2p1"


modprobe nbd max_part=8
qemu-nbd -c /dev/nbd2 image_path
mount /dev/nbd2p1 $work_dir/$image_template


umount $work_dir/$image_template
qemu-nbd -d /dev/nbd2



wget java
-------------
wget --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com"  http://download.oracle.com/otn-pub/java/jdk/6u39-b04/jdk-6u39-linux-x64.bin