Nice hint and tips for using wget

I think most of us have used the wget command once or twice.
What i will do now is explain a few tips and tricks on using this useful command.
1. Download many files at the same time
2. Download and resume
3. Limit your download to a specific speed
4. Split your download for faster results
5. Log your download
6. Download in the background and keep using the terminal

Common use of wget:

wget http://example.com/bleh.tar

1. Download many files at the same time
There is more then one way to do this, my favourite one is to create a .txt file using the vi command and write in it the URLs of the files you want to download

vi downloads.txt

write in it

http://example.com/bleh.tar

http://example.com/tfeh.tar

http://example.com/blah.tar

http://example.com/stuff.tar

Then run wget using the -i argument

wget -i downloads.txt

2. Download and resume
You can force wget to resume any broken download like this

wget -i -c downloads.txt

3. Limit your download to a specific speed
You can use this when downloading a big file and you don’t want the connection to choke

wget -c –limit-rate=20k http://example.com/bigstuff.tar

4. Split your download for faster results
Just like free download manager or download accelerator on windows :D
To do this we will have to use awget instead of wget

aget -n=5 http://example.com/bleh.tar

Note that i could not find aget in the repos. However you can download a .deb package from http://www.enderunix.org/aget/

5. Log your download
Log all your downloads into a file

wget -c -o downloads.log -i downloads.txt

6. Download in the background and keep using the terminal

wget -cbi downloads.txt

Note that doing the above will automatically create a log file for the download process
To specify your own log file location do the following

wget -cb -o downloads.log -i download.txt

Hope this helps :)
// Jo

Problems with sound and video on ubuntu ?

Howdy,


I am writing this post because so many people are asking me about it.
I will not invent anything new here, i will just make a general tutorial that will fix 80% of your audio/video problems.

Please understand that i do not guarantee 100% success result, because it all depends on the hardware you have.

Before digging in complicated stuff, lets first try to install the Medibuntu packages.

Some of these packages include the libdvdcss package from VideoLAN and the external binary codecs package (commonly known as w32codecs) used by MPlayer and xine.

Step 1:
Add Medibuntu to your system’s list of APT repositories.
For ubuntu 7.10

sudo wget http://www.medibuntu.org/sources.list.d/gutsy.list -O /etc/apt/sources.list.d/medibuntu.list

For ubuntu 8.04

sudo wget http://www.medibuntu.org/sources.list.d/hardy.list -O /etc/apt/sources.list.d/medibuntu.list

Now add the GPG Key:

sudo apt-get update && sudo apt-get install medibuntu-keyring && sudo apt-get update



Step 2:
Install the libdvdcss2 package.
This package is used to play encrypted DVDs, more information about it here

sudo apt-get install libdvdcss2



Step 3:
Installing Non-Native Media Formats.
These media formats includes but are not limited to: wmv, mp3, .mov, .rm etc…

For i386 (use this if you are not sure)

sudo apt-get install w32codecs

For amd64

sudo apt-get install w64codecs



For ppc

sudo apt-get install ppc-codecs

This is it, restart your PC now and try to play some music. If you still cannot hear the beat continue reading this post.

mmm… I see you are still having problems ? Lets try to do more complicated stuff.
What we will do now is recompile the alsa drivers

UPDATE: Please be aware that compiling from source should be done as a last resort.
When you compile stuff from source apt don’t know about them, so it wont keep track of it.

Step 1:
Lets download them first.
We need to get: alsa-driver, alsa-lib and alsa-utils.
You can download the latest releases from here:

Step 2:
Untar these packages.
You can untar them using GNOME or by typing this line of code in terminal

tar yxf alsa-driver-xxx.tar.bz2 alsa-lib-xxx.tar.bz2 alsa-utils-xxx.tar.bz2

Note: dont forget to replace xxx by your version number.

Step 3:
To configure/install alsa utilities we need the following package.

sudo apt-get install libncurses5-dev



Step 4:
Installing alsa

In the alsa drivers folder type:

sudo ./configure –with-cards=intel8x0 –with-sequencer=yes ; make ; make install

In the alsa Lib folder type:

./configure
make
sudo make install

In the alsa utilites folder type:

./configure
make
sudo make install



Restart your PC and cross your fingers :)

Hope I helped you in a way.

// Jo

Installing LAMP on Ubuntu 7.10/8.04/8.10 (Linux,Apache,MySQL,PHP)

Lately I’ve been using ubuntu 7.10 for all my projects/daily work.
As a web developer i should have LAMP on my machine and now i would guide you through installing it on yours.

This guide is divided into 3 steps: installing/tesing Apache, PHP and finally MySQL.

Lets start with Apache:
1. Open the terminal (we will be using it through most of my guide) from Applications > Accessories > Terminal
2. Install apache2 using apt-get by typing the following

sudo apt-get install apache2

Note that you should know the root password.
Now everything should be downloaded and installed automatically.
To start/stop apache2 write:

sudo /etc/init.d/apache2 start
sudo /etc/init.d/apache2 stop

Your www folder should be in: /var/www/

If everything is OK you should see an ordinary HTML page when you type: http://localhost in your firefox browser

Finished with Apache ? lets conquer PHP:
1. Also in terminal write:

sudo apt-get install php5 libapache2-mod-php5

or any php version you like
2. restart apache

sudo /etc/init.d/apache2 restart

This is it for PHP :D
Wanna test it ? Just create an ordinary PHP page in /var/www/ and run it.
Example:

sudo gedit /var/www/test.php

and write in it: < ?php echo “Hello World”; ?>

Now run it by typing http://localhost/test.php in firefox… You should see your ” Hello World ”
66 % is over, lets continue to installing MySQL:
1. Again and again in terminal execute:

sudo apt-get install mysql-server

2. (optional) If you are running a server you should probably bind your address by editing bind-address in /etc/mysql/my.cnf and replacing its value (127.0.0.1) by your IP address

3. set your root password (although mysql should ask you about that when installing)

mysql> SET PASSWORD FOR ‘root’@'localhost’ = PASSWORD(‘xxxxxx’);

4. Try running it

mysql -uroot -pxxx

where xxx is your password.
Note: You can install PHPMyAdmin for a graphical user interface of MySQL by executing

sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin

5. restart apache for the last time

sudo /etc/init.d/apache2 restart

Congratulions your LAMP system is installed and running :D
Happy Coding

//Jo

UPDATE:
Due to the large number of people emailing about installing/running phpmyadmin.
Do the following:

sudo apt-get install phpmyadmin

The phpmyadmin configuration file will be installed in: /etc/phpmyadmin
Now you will have to edit the apache config file by typing

sudo vi /etc/apache2/apache2.conf

and include the following line:

Include /etc/phpmyadmin/apache.conf

Restart Apache

sudo /etc/init.d/apache2 restart

Another issue was making mysql run with php5
First install these packages:

sudo apt-get install php5-mysql mysql-client

then edit php.ini and add to it this line : ” extensions=mysql.so” if it isnt already there

sudo vi /etc/php5/apache2/php.ini

Restart Apache

sudo /etc/init.d/apache2 restart

Hope this helps :)