↑ ↓ select, Enter open, Esc close

Collect all URLs from a sitemap index

Adjust the values, the command updates live
user@server
curl -s https://example.com/sitemap_index.xml | grep -oP '(?<=<loc>)[^<]+' | xargs -n1 curl -s | grep -oP '(?<=<loc>)[^<]+' | sort -u

First reads the child sitemaps from the index, fetches them one after another and collects all <loc> entries. Typical for WordPress (wp-sitemap.xml), Yoast and Rank Math (sitemap_index.xml). Append | wc -l to get the total number of submitted URLs.

Note: Image sitemaps with <image:loc> are not counted. Indexes nested more than one level deep are not resolved.

Also searched as

  • get all urls from sitemap_index.xml
  • extract urls from wp-sitemap.xml
  • fetch all child sitemaps
  • full url list from sitemap index

Related one-liners

All in SEO checks

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.