Lima was defended by the remnants of the Peruvian army and crowds of civilians in the lines of San Juan and Miraflores. As the invading army advanced, the towns of Chorrillos and Barranco were occupied on January 13 of the same year while the town of Miraflores was captured on the 16 of January, after the Battle of Miraflores; finally the city of Lima was occupied on January 17, 1881 until October 23, 1883 when Miguel Iglesias regained control of the Peruvian government.
In January 1881, Chile controlled the sea along the coasts of Peru, as well as the provinces of Tacna, Arica and Tarapacá. The Chilean troops disembarked in the Peruvian towns of Pisco and Chilca, located to the south of Lima. General Manuel Baquedano was in control of the army of Chile during the Lima campaign.
Lima was going to be defended at first by the remaining Peruvian army and by a vast number of civilians in the line of San Juan - Chorrillos; the American engineer Paul Boyton narrates that " the troops were of natives who had been recruited in the mountain ranges and forced to fight, hundreds of them never had seen before a city ". On the other hand, the strategic line of Miraflores was defended by more troops than civilians.
Nonetheless, and with little effective Peruvian central government remaining, Chile pursued an ambitious campaign throughout Peru, especially along the coast and in the central Sierra, penetrating as far north as Cajamarca, seeking to eliminate any source of resistance.
As the war progressed in Chile's advantage, the Chilean Army liberated thousands of Chinese coolies who had been enslaved; for more info see Huanillos "Chinese slaves were very common in that time because in 1850 the Peruvian government made a trade agreement with China; the Peruvian government would give 50 soles per Chinese who worked in the different industries of the time. However the Chinese people, especially men, were treated so badly that a large number of them committed suicide and the few who survived were rescued by Patricio Lynch, a Chilean military officer who fought in The Pacific War."
Liberated Chinese served as helpers with the Chilean army and even formed a regiment under the command of Patricio Lynch, whom the Chinese named 'the red prince'.