Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to recursively retrieve all possible urls (internal page urls) from a website.

Can you please help me out with wget? or is there any better alternative to achieve this? I do not want to download the any content from the website, but just want to get the urls of the same domain.



I tried doing this in wget, and grep the outlog.txt file later. Not sure, if this is the right way to do it. But, It works!

$ wget -R.jpg,.jpeg,.gif,.png,.css -c -r -o urllog.txt
$ grep -e " http" urllog1.txt | awk '{print $3}'
share|improve this question

migrated from Aug 30 '11 at 6:58

This question came from our site for professional and enthusiast programmers.

This question isn't very clear. What do you mean by "all possible URLs"? Do you want to start with one website and then crawl to all its linked websites, recursively? If so, how do you want to achieve that without downloading the actual websites, which you need to parse for further links? – Kerrek SB Aug 29 '11 at 10:43
What did you try? wget -r is the recursive option. Did you try with that? What problem did you run into? – steenhulthin Aug 29 '11 at 10:47
Just use wget -r Also nice option is -p which will also fetch all prerequisites for the page, even if they are external. – dma_k Aug 29 '11 at 10:47
@abhiomkar: Well, yes, you wouldn't download all the pictures and flash animations of course. The -r option already does exactly that. If you also want stylesheets that may be linked inside other style sheets, you have to work a bit harder, but for the semantic content only, -r is exactly the answer. Did you try any of this before asking the question, by the way? I think wget has a pretty decent documentation... – Kerrek SB Aug 29 '11 at 10:55
Dupe… – giorgio79 May 25 '14 at 10:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.