Nice hint and tips for using wget

on Friday, February 20th, 2009 at 12:28 am

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

Javascript images pre-loader

on Monday, January 19th, 2009 at 5:49 pm

Here you are, doing a photo gallery and in that photo gallery you have many thumbnails that on click will display the larger picture.
If you are using the simple “document.getElementById(‘someid’).innerHTML=’‘” or many other javascript method to load your images then you have a problem.
When the user click he will have to wait for the image to load and sometimes will see parts of the images opening bit by bit.
This javascript preloader will load all your desired images in the background and so when you call them they are ready to be displayed :)

This will come handy also a lot when doing a javascript slide show… but this will be my next post here :)

Demo: http://joeabiraad.com/demos/preloader/
Files: http://joeabiraad.com/demos/preloader/preloader.rar

Hope it helps
//Jo

How to do a fixed footer using only CSS

on Monday, January 19th, 2009 at 1:15 am

The last CSS tutorial i wrote was about making a two level menu using CSS/JS, well this one is about fixed footers…



You know how it is ! you just wanna keep this footer still while navigating through the page.

Peace of cake :)

The main thing is to fix that position to bottom: 0px and the rest will follow !

#footer {
min-width:770px;
width: 100%;
position: fixed;
z-index: 5;
bottom: 0px;
}

Check the demo http://mazesolutions.me/demos/footer/
Download the files http://mazesolutions.me/demos/footer/footer.rar
To get the full working menu http://mazesolutions.me/website-production/how-to-do-a-menu-with-sub-items-using-css/130

Hope i helped in a way :)
// Jo

Changing the welcome message in SSH

on Thursday, December 18th, 2008 at 1:57 pm

If your a linux user or maybe a simple linux server administrator with some servers at hand, the chances are that you use SSH to login there and manage them.

When a user logs in to SSH usually he sees a welcome message.
If you have an ubuntu machine like me then you will see the following message

Linux jo-desktop 2.6.27-9-generic #1 SMP Thu Nov 20 21:57:00 UTC 2008 i686

The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

To access official Ubuntu documentation, please visit:

http://help.ubuntu.com/

In order to change this message just type in the terminal

sudo vi /etc/motd

Screenshot

Update:
Note: On restart your changes to /etc/motd will be reverted, the reason is that /etc/motd is a symbolic link to /var/run/motd which is rebuilt by /etc/init.d/bootmisc.sh from a template, /etc/motd.tail, at each reboot. (thank you Adam Trickett).

jo@jo-desktop:/etc$ ls -l motd
lrwxrwxrwx 1 root root 13 2008-11-27 14:18 motd -> /var/run/motd
jo@jo-desktop:/etc$

This means that to make your changes permanent you can either:
1. change

/etc/motd.tail

then reboot

2. point the /etc/motd symlink to a different file such as /etc/motd.static and make your changes there. (Also thank you Adam Trickett).

Joe