WGET – usage tips

Examples:

If you need only to download something from an url:

wget http://cristian-radulescu.ro/image.gif

With user (abc) and password (abc123):

wget http://cristian-radulescu.ro/document.pdf --user=abc --password=abc123

Download from an url list (list.txt):

wget -i list.txt

When the connection fails you can continue:

wget -c http://cristian-radulescu.ro/arhiva.zip

The default number of retries is set to 20. Set the number of retries to infinity:

wget -t 0 -c http://cristian-radulescu.ro/archive.zip

Download all files from a directory:

wget -p http://cristian-radulescu.ro/directory/

Download files with specific extensions (.jpg, .gif, .png):

wget -nd -r -l1 -A.jpg -A.gif -A.png http://cristian-radulescu.ro/pictures/

(-nd no directory, -r recursive download, -l1 level 1, no subdirectories).

Shell script example:

If the files are named useng a pattern (like wallpaper_1.jpg, wallpaper_2.jpg, …, wallpaper_284.jpg, wallpaper_285.jpg) you can use a simple shell script:

#!/bin/bash
for ((i = 1; i <= 285; i ++))
  do
    wget -c "http://cristian-radulescu.ro/wallpapers/wallpaper_"$i".jpg"
done

or type in a console:

for ((i = 1; i <= 285; i ++)); do wget -c "http://cristian-radulescu.ro/wallpapers/wallpaper_"$i".jpg"; done

More details:

wget --help

or

man wget

in a console.

Using multiple yahoo accounts at the same time

If you have more than Yahoo accounts and you want to use them in the same time, there is a simple way to do it, by using an alternative instant messenger client or by executing some small tweaks on the Yahoo Messenger client.

Alternatives:

Alternatives to the Yahoo Messenger client are Pidgin, Miranda or Trillian. You can open as many accounts as you want with Pidgin, which is free and open-source, has lots of useful plugins.

Tweaking the Yahoo Messenger client:

You need to add a key in the windows registry. Just follow the images step by step.

  • Go to START -> Run type regedit, press OK.
    start run regedit
  • In the Registry Editor window, double click on the HKEY_CURRENT_USER.
    regedit hkey_current_user
  • Double click on Software.
    regedit hkey_current_user software
  • Dublu click on Yahoo.
    regedit hkey_current_user software yahoo
  • Double click on pager.
    regedit hkey_current_user software yahoo pager
  • Single click on Test (or test).
    regedit hkey_current_user software yahoo pager test
  • On the right column of the window, right click somewhere below Default, and select New -> DWORD Value.
    regedit dword value
  • A new element will be created; rename it plural.
    regedit redenumeste plural
  • Dublu click on plural; in the new window set Value data to the maximum number of Yahoo Messenger windows you want to be opened at the same time (if you set it to 10 – you will be able to open 10 Yahoo Messenger windows simultaneously).

That’s all. Close Registry Editor and try to open more Yahoo Messenger windows.

How to create a simple shell script

Here is a simple example of creating and running (executing) a shell script. This script will display the numbers from 1 to 10.

Creating the script:

  • With any text editor (Gedit for Gnome, Kate for KDE, nano):
    #/bin/bash
    for ((i = 1; i <= 10; i ++))
    do
        echo $i
    done
  • Save it as myscript.sh.

Setting the execution rights:

Open a console, go to the directory where the script was saved and type:

chmod +x myscript.sh

Running the script:

  • In the console type:
    ./script.sh

    or

    sh script.sh

    The result should be like this:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10

Diacritics in web pages

The usage of diacritics in web pages requires Unicode encoding.

In the head section of the page (between <head> and </head>) you need to insert this line:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Here is a list with the corresponding HTML codes of the romanian diacritics :