Tag Archives: Linux

How to reduce your virtualbox linux virtual machine size

After using a linux virtual machine that has been configured with dynamically expanding drive, the size gets larger even if you remove files from it.

Here is the steps to shrink your linux virtual machine size :

1- Remove any unnecessary files you don’t need from the virtual machine.

2- Fill the unused spaces on it with zeros.

  • Open the virtual machine.
  • Install zero free
sudo apt-get install zerofree
  • Reboot the machine in repair mode, and login to root shell
  • Kill any processes using the hard disk.
service rsyslog stop
service network-manager stop
killall dhclient
  • list your virtual machine harddisks
df
  • Unmount and Fill all the unused spaces for each physical drive on the machine with zeros.
mount -n -o remount,ro -t ext3 /dev/sda1 /
zerofree /dev/sda1
  • Shutdown the machine.

3- Clone the old HD file into a new shrinked one

VBoxManage clonehd oldHd.vdi newHd.vdi

4- Now add the new cloned HD file as the new HD for the machine and test it.

5- Remove your old HD file.

 

Compress and Split large files under Linux

One of the common problems i used to face is transferring large files from Linux through mediums that doesn’t support large files, especially when it comes to more than 100 GB files, usually that is a virtual machine hard disk, or backup file.

To compress and split files under linux, this command can be used:

tar -cvj large-file.dvi | split -b 1000m -d - "small-files.tar.bz."

This command will compress and split the “large-file.dvi” to many files with size 1000mb for each, giving it the name “small-files.tar.bz.0, small-files.tar.bz.1, etc….”

To join the files together again, this command can be used:

cat small-files.tar.bz.* > large-file.tar.bz

and to extract the output file :

tar -xvj large-file.tar.bz

Good Solaris How To list

Was looking for a way to grep for something in a subdirectory and stopped by this short but usefull Solaris How To list.

The grep item works with unix / linux boxes as well.

http://jeffnester.com/howtos/solaris/solaris.html

enjoy the power of shell 🙂

Installing Java plugin for Firefox on Ubuntu 10.4 (Lucid)

After upgrading from Ubuntu 9.10 to 10.4, I had some issues getting Java to work with Firefox, after checking the software center, I found that the Java plugin has been removed.

To get this fixed, I simply followed the steps in here http://ubuntuforums.org/showpost.php?p=9008918&postcount=32 and it worked well after that.

PHP is Now

Lots of people asks the question why php, i guess this article titles “PHP is Now” by Cal Evans is the Director of the PHP Center for Expertise at Ibuildings, will help those who asks, to know what is the powers of this great tool.

article URL: http://www.ibuildings.com/blog/archives/1554-PHP-is-NOW.html

Install Yum on RHEL4

In my company they purchased some software from Autodesk that comes on Redhat Enterprise 4, i needed to install some packages on the system for the use of some internal applications, instead of installing packages and all the dependencies, i though using automatic installer like yum would be better, below is the steps to have yum installed on your RHEL4 machine :

1. Install rhel4
2. Download Yum rpm package

wget http://gd.tuwien.ac.at/opsys/linux/yum/2.0/yum-2.0.5-1.noarch.rpm

3. Install the package

rpm -Uvh yum-2.0.5-1.noarch.rpm

4. Edit repositories location

nano /etc/yum.conf

Change the baseurl in [base] to

http://mirror.centos.org/centos/4/os/$basearch/

Change the baseurl in [updates] to

http://mirror.centos.org/centos/4/updates/$basearch/

5- Install the full yum with all its dependencies.

yum install yum

Converting bin image to iso on Ubuntu

Well, first you have to install bchunk

sudo apt-get install bchunk

then use the command as following to convert the image

bchunk image.bin image.cue image.iso

and the bin image will be converted to iso one in the same folder.

How to disable sudo password prompt in Linux

well, sometimes i want to execute commands as super user without being asked for password each time to do that

to do that its pretty easy

open the terminal and type this command :

sudo visudo

and uncomment the following line :

# %sudo ALL=NOPASSWD: ALL

save the file by pressing escape then typing :wq and pressing enter.

from now on you will not be asked when executing the command as super user using sudo.

Flowchart applications on Ubuntu

If you would like to draw diagrams and flowcharts on your ubuntu there is 2 programs that is alternative to smart draw on windows :

  • Dia

to install type the following command in terminal :

sudo apt-get install dia
  • Kivio

Kivio
Kivio

to install type the following command in terminal :

sudo apt-get install kivio

U can use them also to draw mind maps

enjoy 😉

How to read chm files on Ubuntu

This can be easily done with install GnoCHM, the CHM viewere for Linux

you can install it by executing this command in the terminal

sudo apt-get install gnochm

enjoy 😉