I have tried to retrieve them from the api with the following:
wget -O allcities.xml "http://www.overpass-api.de/api/xapi_meta?node[admin_level=8]"
however it does not seem to return all of them. From the doc Admin Level 8 should be cities, towns and villages but it seems to only contain major cities. I get a list of about 12000 nodes.
I am actually looking into getting all inhabited places on earth with at least 1000 population.
I am also downloading the whole planet in PBF format, in case using the API is not possible. How would I be able to achieve the same using such file?