Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

How to simulate curl using wget command?

Answer:

To simulate a simple curl command using wget, e.g. curl http://www.google.co.uk:

# wget -O- http://www.google.co.uk

To view the HTTP response header (i.e. more verbose), e.g. curl -v http://www.google.co.uk:

# wget -O- -S http://www.google.co.uk

Print the web site's content using wget

Answer:

To show the web site's content in command line, just one command with wget.

# wget -q -O- http://www.example.com

Easy enough?

Mirror a web site using wget

Answer:

wget is a standard program came with most Linux distributions. It allows you to create a mirror (backup) of a web site easily using the following command.

# wget -m -k -K -E http://www.example.com

wget with rate limiting

Answer:

When you are downloading a large file, and you want to limit the bandwidth used, it is easy with the wget command

wget --limit-rate=100k http://www.example.com/file.zip

The above command will limit the rate to be used not to exceed 100kbps.

How to force re-download a file using wget?

Answer:

Use the -nc flag, e.g.

# wget -nc ftp://sunsite.doc.ic.ac.uk/ls-lR.Z