Search This Blog

Tuesday, December 28, 2010

Wget: A utility to download files from the Web

GNU Wget is a free utility for non-interactive download of files from the Web. It supports http, https, and ftp protocols, as well as retrieval through http proxies. Wget is non-interactive, meaning that it can work in the background, while the user is not logged on. This allows you to start a retrieval and disconnect from the system, letting Wget finish the work.

1. Download Single File with wget

$ wget http://www.filehippo.com/download/xyz.tar.bz
2. Store download file With a Different File name

$wget http://www.filehippo.com/download/scripts/index.php?option=
com_content&&Itemid=53

will download the file as 'index.php?option=com_content&&Itemid=53'

but if we use -o option as follows

$ wget -o myscript.php http://www.filehippo.com/download/scripts/
index.php?option=com_content
&&Itemid=53

file will be downloded as 'myscript.php'
3. Continue the Incomplete Download

IF we initiated a very big file download which got interrupted in the middle. Instead of starting the whole download again, we can start the download from where it got interrupted using option -c

$ wget -c 'www.chandomama.com'

If a download is stopped in middle and you restart the download again without the option -c, wget will append .1 to the filename automatically as a file with the previous name already exist. If a file with .1 already exist, it will download the file with .2 at the end.

4. Download in background

For a huge download, put the download in background using wget option -b as shown below.
$wget -b http://www.openss7.org/repos/tarballs/strx25-0.9.2.1.tar.bz2
Continuing in background, pid 1984.
Output will be written to `wget-log'.

It will initiate the download and gives back the shell prompt . We can always check the status of the download using tail -f as shown below.

$ tail -f wget-log
Saving to: `strx25-0.9.2.1.tar.bz2.4'

0K .......... .......... .......... .......... ..... 1% 65.5K 57s
50K .......... .......... .......... .......... .... 2% 85.9K 49s
100K .......... .......... .......... .......... ... 3% 83.3K 47s
150K .......... .......... .......... .......... ... 5% 86.6K 45s

5. Mirror of website

To take a backup of blog or create a local copy of an entire directory of a web site for archiving or reading later. The command:

wget -m http://ginatrapani.googlepages.com

Will save the two pages that exist on the ginatrapani.googlepages.com site in a folder named just that on your computer. The -m in the command stands for "mirror this site."


6. Download recursively

To retrieve all the pages in a site use -r option. It downloads the entire website recursively

wget -r 'www.chandomama.com'

If you want to retrieve all the pages in a site PLUS the pages that site links to. You'd go with:

wget -H -r --level=1 -k -p http://ginatrapani.googlepages.com

This command says, "Download all the pages (-r, recursive) on http://ginatrapani.googlepages.com plus one level (—level=1) into any other sites it links to (-H, span hosts), and convert the links in the downloaded version to point to the other sites' downloaded version (-k). Oh yeah, and get all the components like images that make up each page (-p)."

Warning: Beware, those with small hard drives! This type of command will download a LOT of data from sites that link out a lot (like blogs)! Don't try to backup the Internet, because you'll run out of disk space!

7. Download Only Certain File Types Using wget -r -A

You can use this under following situations:

  • Download all images from a website
  • Download all videos from a website
  • Download all PDF files from a website
$ wget -r -A.pdf http://url-to-webpage-with-pdfs/


Source: http://www.thegeekstuff.com/2009/09/the-ultimate-wget-download-guide-with-15-awesome-examples/#more-1885
http://lifehacker.com/161202/geek-to-live--mastering-wget

Monday, December 27, 2010

Grub2 recovery




Grub 2 Recovery:-
Boot from live CD or DVD which support grub2.(BOSS 4 DVD or Ubuntu 9.10 CD or above. DVD will take more time than CD thats why I suggest to boot from CD).
Open terminal.Run fdisk -l to check the partition from which you want to recover grub 2.
Here I assume that you want to recover it form /dev/sda1.
Then run the following commands:-
$sudo mkdir /media/sda1
$sudo mount /dev/sda1 /media/sda1
$sudo mount --bind /dev /media/sda1/dev
$sudo mount --bind /proc /media/sda1/proc

Then chroot into that partition by
$sudo chroot /media/sda1

Then re-install the grub by

#grub-install /dev/sda
The output should be like this:-
Installation finished. No error reported.

If you get error then try
#grub-install --recheck /dev/sda

After successful installation exit from chroot unmount the file systems you mounted and reboot.
#exit
$sudo umount /media/sda1/proc
$sudo umount /media/sda1/dev
$sudo umount /media/sda1
$sudo reboot


Source

http://my.opera.com/seanawake/blog/2010/02/09/grub-2-recovery-with-ubuntu-live-cd-2


Tuesday, December 21, 2010

How to find out the version/name of Linux?

Run the following command:
   
                 lsb_release -a




How to Install True Type Fonts on Linux

 Steps

   1. Move all your fonts to the ~/ Directory. The ~/ Directory is your home folder. So if you were logged in as boss, the directory would be /home/boss/ .
   2. Open up the terminal. Assuming you've already extracted/copied the  font to the ~/ directory. Type: "cd /usr/local/share/fonts/truetype" without the quotes (the path is "/usr/share/fonts/truetype" on some distros). What this does is changes the directory to the truetype fonts directory.
   3. Type in "sudo mkdir myfonts" also without quotes. Assuming you're not logged in as root, this will ask you for your password.  Just type in your password, press enter, and the directory 'myfonts' will be created.
   4. Type in "cd myfonts" . Then type in "sudo cp ~/*.ttf  ." . These will get your font in the /myfonts directory.
       Run following command the to change the permission of fonts:
     sudo chmod 644 *.ttf
   5. In order to install the font, ownership has to belong to root, so type in "sudo chown root.root *.ttf" and after that "sudo mkfontdir" which makes a directory for your font.
   6. Now your font is installed, but it will disappear the next time system starts up, so you just need to type "cd .." and after that "fc-cache" .

or sudo fc-cache  -f


Every time you install a font after the first time, you can skip step #3.

Source: http://www.wikihow.com/Install-True-Type-Fonts-on-Ubuntu

Wednesday, December 1, 2010

How to install exe file on BOSS through WINE

To install wine packages you can use two methods: add the repository or download a .deb package and manually install it, but first of all you have to remove older wine version. If you use the first method you'll have wine automatically upgraded by apt, otherwise you'll need to manually download and install every new version.

Remove old version

Open a terminal

$ sudo apt-get remove libwine wine #to remove outdated version of wine

Method 1:

Open a terminal and run the following commands:

$ sudo apt-get update #to update package list

$ sudo apt-get install wine #to install latest wine version


Note: For other linux system, if the above command (sudo apt-get install wine) gives error "wine is not a installable candidate" or similar error then do the following:

Open repository file with a text editor (you can use gedit or another) by following command

#gedit /etc/apt/sources.list

Add this line for Lenny: deb http://www.lamaresh.net/apt lenny main

Add this line for Squeeze: deb http://www.lamaresh.net/apt squeeze main

Add this line for Sid: deb http://www.lamaresh.net/apt sid main

Save and close sources.list

Now run the following commands:

wget -O - http://www.lamaresh.net/apt/key.gpg | apt-key add - #to add gpg key

apt-get update #to update package list

apt-get install wine #to install latest wine version


Method 2: Download .deb and manually install it

Chose a .deb package from binary list and save it in your home directory

Open a terminal

cd ~ #to go to your home directory

su #to log as root

dpkg -i wine_1.1.xxx.deb #change xxx with your chosen package, this will install wine



Configuring Wine

Before using Wine, it is necessary to create the pseudo C:\ drive where your Windows applications will be installed. Enter Wine configuration mode by issuing following command on your machine,

winecfg

You can also select the Configure Wine option in the Applications ? Wine menu. This will create the .wine directory in your home directory. This is used to store all the configurations and the pseudo C drive. It also contains a bunch of other things including but not limited to the registry structure like that in Windows, configurations settings like the Windows version to be emulated, DLL overrides and specific memory related settings. We don’t need to go into the details of those at this moment.

Installing Applications

To install Windows applications with Wine, follow the instructions below,

  1. Download the Windows application you wish to install and place it in a convenient directory.
  2. Open the terminal on your system.
  3. Change to the directory where the application installer is located.
  4. Issue the command wine followed by the name of the application to install it.

e.g.:

wine someApplication.exe

Remember to give the full name of the application along with the extension.

Running the Wine applications

Most application installed via Wine will end up in a special Wine menu in your main menu and you can directly launch those applications from there.

Uninstalling the applications

To uninstall the applications, open up a terminal and type “uninstaller” – this will open up a program which lets you uninstall applications from Wine. Running uninstall programs directly via Wine should also work normally. Alternatively, you could also simply delete the folder of the application but it leaves traces of that application behind in the registry and other configuration files.


Source: http://www.noob2geek.com/linux/how-to-install-exe-files-on-ubuntu/