How To Zip/Unzip Tar/Untar any zip/tar/tar.gz In Linux

April 19, 2009 by fitus

I always forget the “tar -***” combination’s, and this should be a great reference for everyone who same as me ,forgets how to use the “tar-***” combination’s

Get help from the terminal
‘zip’ or ‘unzip’
tar –help
(see above)
(see above)

List the file’s contents

unzip -l file.zip
tar -tvf file.tar
tar -ztvf file.tar.gz
tar -ztvf file.tgz

Extract the file’s contents
unzip -aq file.zip
tar -xf file.tar
tar -zxf file.tar.gz
tar -zxf file.tgz

Create a zip/tar file
zip -9rq file.zip dir/
tar -cf file.tar dir/
tar -zcf file.tar.gz dir/
tar -zcf

Installing Vmware server on linux

April 15, 2009 by fitus

After being fighting and crying with linux for about a few hours I used a weapon that all elites should know ( google ) and I found some instruction on how to install  VMware Server on linux. ( I installed on dreamlinux 3.5 ) but I think it will install on any linux , I hope.

With VMware Server you can let your old Windows desktop (that you previously converted into a VMware virtual machine with VMware Converter, as described in this tutorial: http://www.howtoforge.com/vmware_converter_windows_linux) run under your PCLinuxOS desktop. This can be useful if you depend on some applications that exist for Windows only, or if you want to switch to Linux slowly.

To download VMware Server, go to http://www.vmware.com/download/server/ and click on Download Now:

Accept the license agreement by clicking on Yes:

Then download the VMware Server for Linux .tar.gz file (not the rpm file!) to your desktop (e.g. to /home/( your name ) /Desktop):

To get the serial number you need to run VMware Server, go to http://register.vmware.com/content/registration.html. Fill in your personal details. Afterwards you will get a page with a serial number for VMware Server. Write it down or print it out:

To install VMware Server, open a terminal and become root:

su
Pwd

Then go to the location where you saved the VMware Server .tar.gz file, e.g. /home/ ( your name ) /Desktop ( your name ) (replace with your own username! ):

cd /home/ ( your name ) /Desktop

Unpack the VMware Server .tar.gz file and run the installer:

tar xvfz VMware-server-*.tar.gz
cd vmware-server-distrib
./vmware-install.pl

The installer will ask you a lot of questions. You can always accept the default values simply by hitting <ENTER>. When it asks you

In which directory do you want to keep your virtual machine files?
[/var/lib/vmware/Virtual Machines] and so on , I just kept pressing enter on every question

( But….. )
you can either accept the default value or specify a location that has enough free space to store your virtual machines.

At the end of the installation, you will be asked to enter a serial number:

Please enter your 20-character serial number. and press enter ( I strongly recomend to have the serial # ready )

Type XXXXX-XXXXX-XXXXX-XXXXX or ‘Enter’ to cancel:

Fill in your serial number for VMware Server.

After the successful installation, you can delete the VMware Server download file and the installation directory:

cd ../
rm -f VMware-server*
rm -fr vmware-server-distrib/

Now we have to create a menu entry for VMware Server. Right-click on the PC icon:

and select System / Menu Editor.

I’d like to have the VMware Server menu entry in the System submenu, so I mark System and click on the New Item button:

As Item name, I fill in VMware Server:

In the Command field, I type in /usr/bin/vmware

Then I click on the Icon button:

and select the VMware icon:

Afterwards we can close the Gnome Menu Editor window. When you do it, you will be asked if you want to save your changes. Click on Save:

You will now find VMware Server in the System submenu.

When you start it, select Local host:

Afterwards, you can create virtual machines (or import your virtual Windows machine that you created with VMware Converter):

11 Inventory (III)

We have now all wanted applications installed:

Have fun.

How to mount an NTFS external usb hard drive in linux

April 13, 2009 by fitus

You may have a an external Windows NTFS harddrive which doesn’t play nicely with Linux, ie you plug it into the USB……… nothing, won’t mount, pffft. I put an 80Gb laptop harddrive into one of those external USB harddrive boxes and this happened to me.

*note* I use the Nano text editor, just put Mousepad or Gedit if that’s what you use.

To solve it, you just have to add one line to your fstab file.

sudo nano /etc/fstab

Then add this at the bottom:
**My drive was listed as sda1, and another is sdb, yours maybe different, edit accordingly**

/dev/sda1       /media/disk     ntfs-3g force 0 0

Now just issue the mount command:

sudo mount -a

And checkout the /media/disk directory. Your precious data should be there

Installing a second hard drive In Linux

April 12, 2009 by fitus

Installing a second hard drive is easy if you know how. I needed to do this on my server and below is the steps I followed.

Assumptions

  • I assume that you have installed the hard drive in your PC, and
  • That you have rebooted your machine
  • In this example our primary hard drive is located at /dev/hda and our second, new hard drive is located at /dev/hdc (replace according to your system)

Installation

The first step is to check to see that your new hard drive is installed and picked up by Debian. You do this by running the following command in a shell:

fdisk -l

This will give you an output that should look something like this:

Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1        9354    75135973   83  Linux
/dev/hda2            9355        9729     3012187    5  Extended
/dev/hda5            9355        9729     3012156   82  Linux swap / Solaris

Disk /dev/hdc: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

You can see that the 500GB disk at /dev/hdc is being picked up but there are no partitions yet for this drive.

Partitioning your new drive

Next up we need to partition our drive with the following:

cfdisk /dev/hdc

The cfdisk controller will load up and here you can create a new partition on your drive. From the menus at the bottom I selected the following:

1. New >> Primary >> Size in MB
2. Once done select Write
3. Select Quit

Your new partition has been created at /dev/hdc1

Format the new disk

Now that we have a new partition at /dev/hdc1 we need to format it for usage by the system. From a Linux shell type:

mkfs.ext3 /dev/hdc1

This will now format our partition with the ext3 filesystem which should work fine for your Debian system.

Mount your new drive

Now that we have partitioned the drive and formatted it we can now mount the drive to begin using it. From a shell run:

mkdir /new-disk
mount -t ext3 /dev/hdc1 /new-disk

The above commands create a new directory for the drive to be mounted in and then we mount the drive to this directory. To check that the drive has been mounted run the following:

ls -lsa /new-disk

You should see the following:

root@debian:/# ls -lsa /new-disk
total 24
 4 drwxrwxrwt  3 root root  4096 2007-01-29 01:57 .
 4 drwxr-xr-x 22 root root  4096 2007-01-29 01:58 ..
16 drwx------  2 root root 16384 2007-01-29 01:57 lost found

Adding to fstab

Everything is now up and running however we need to add our new drive to /etc/fstab so that it will be mounted automatically when we reboot the machine.

First let’s edit fstab:

vim /etc/fstab

At the end of the file add the following line:

/dev/hdc1       /new-disk            ext3    defaults,errors=remount-ro 0       1

Save the file and you’re done.

hope it helps someone having the same problem I had trying to install a second hard drive on linux.

How to fix, restore grub

April 5, 2009 by fitus

Today I installed another linux distro to test it on my box, to my surprise when I restarted my box, grub returned an Error 21. I know this means that it can’t find the grub.conf file, but I didn’t know how to fix this, so after searching for a solution to my problem I finally got it fixed, so I decided to share with whomever may be strugglin with the same problem I had, so here it is.

1. Boot your computer up with any live linux distro cd, ( I used dreamlinux )

2. Open a terminal window or switch to a tty.

3. Go SuperUser (that is, type “sudo -s”). Enter root passwords as necessary.

4. Type “grub”

5. Type “find /boot/grub/stage1″. You’ll get a response like “(hd0,1)”.

Use whatever your computer spits out for the following lines.

6. Type “root (hd0,1)”, or whatever your hard disk + boot partition numbers are for your linux install.

7. Type “setup (hd0)”, to install GRUB to MBR, or “setup (hd0,1)” or whatever your hard disk + partition number is, to install GRUB to a partition.

8. Quit grub by typing “quit”.

9. Reboot and remove the bootable CD.

Note:- In the above procedure hd0,1 is an example it might be different in your case.

Installing deb files on linux

April 5, 2009 by fitus

Today I was struggling trying to install a deb. file that i had downloaded from the net, so I told myself why not write a mini how to in my blog, and so here is.

Using the apt-get application is the quickest way to find and install debian packages. The installation part is done by an application named Dpkg.

Dpkg doesn’t have to be used by apt-get, you can use it manually as well.

From the man dpkg command:

Dpkg – a medium-level package manager for Debian Whatever that means. In keeping with GNU/Linux system security, only the superuser can use the dpkg application.

Dpkg is a typical GNU/Linux application that is controlled by command-line switches. Possibly the most common use of dpkg is to install a local .deb file.

To install a .deb file, become root and use the command: dpkg -i filename.deb

Dpkg can also be used to:

* dpkg –unpack: unpacks the file but does not install it * dpkg –configure: presents whatever configuration options are available for the package * dpkg –remove: removes a package Some of the package manipulation commands are actually carried out by an application called dpkg-deb.

In those cases, dpkg just acts as a front end to dpkg-deb and passes the commands to it.

Dpkg-deb can also be used to manipulate .deb files. Some of the more useful commands of dpkg-deb are:

dpkg-deb –show filename.deb This will display the information for filename.deb. Normally, this is boring information like the application version (which is normally evident from the filename), but in some cases more interesting and useful information is displayed.

Consult the dpkg man page for information on the more arcane uses for dpkg.