Signs of the appearance of the Mahdi

The signs of the appearance of the Mahdi are the collection of events, according to Islamic eschatology, that will occur before the arrival of the Mahdi, The signs differ based on Sunni and Shia branches of Islam.
Mahdi will be the last of the minor signs of the Judgement Day. Therefore all signs of the Judgement Day are also considered as the signs of the appearance of Mahdi.
According to some narrations, there are five certain signs that will occur prior to the appearance of the Mahdi. The hadith of Ja'far al-Sadiq mentions these signs: "the appearance of Sufyani and Yamani, the loud cry in the sky, the murder of Nafs-e-Zakiyyah, and the earth swallowing (a group of people) in the land of Bayda which is a desert between Mecca and Medina.
Gabriel will shout loudly and it will be heard from the sky and in other interpretations it is stated to be that "...some of the people of Mecca will come to him, bring him out against his will and swear allegiance to him between the Corner and the Maqam...". Hence, that loud cry may be actually from the people present at the Kaaba on that particular day.
According to some narrations Sufyani, one of the descendants of Abu Sufyan, will arise before Mahdi's appearance. He has been depicted as an outwardly devout man that will take care to remember Allah at all times. But in reality he will be the most wicked man in the world. He will upraise during the Rajab. After he realizes that Mahdi has appeared, he will send away an army to fight him. Some books say that the army of Sufyani before getting to the army of Mahdi will sink into the earth in the Bayda, a desert between Mecca and Medina. The appearance of Sufyani is mentioned in both Shia and Sunni narrations.
In some narrations, the appearance of Yamani is mentioned as one of the certain signs of twelfth Imam's reappearance. The fifth Shia Imam, Muhammad al-Baqir, described Yamani in detail in a hadith:"... among these individuals (Sufyani, Yamani and Khorasani) the Yamani is the closest to guidance, for he calls the people to join the Mahdi. When he rises, the trading of weapons will be prohibited for every Muslim. When he rises, join him immediately, for his flag is the flag of guidance and prosperity and no Muslim should oppose it. Any one who does so will go to hell, because the Yamani calls to the right path." Some sources mention that the Yamani and the Khurasani will be allied against the Sufyani.
The third certain sign that is mentioned in the above narration is the loud cry in the sky. According to tradition two cries will be heard. In the first of them Gabriel will call the name of Al-Qa'im and his father and say that truth is with Ali and his Shia. All people will hear Jibreel's cry in their own language. In a tradition of Ja'far al-Sadiq that is narrated by Zurarah ibn A'yan, it is said that after this cry Shaitan will call certainly, so and so and their followers are victorious ones and his meaning is a man from Banu Umayya. He adds that the person who make the first cry says the truth.
Al-Nafs al-Zakiyyah will be one of the descendants of Husayn ibn Ali. He will be without any sin or crime; yet he will be murdered. According to many narrations, he will be the envoy of Mahdi to Mecca before his reappearance. When he arrives in Mecca and delivers his message, the people of Mecca will slay him near the Kaaba.
The sinking of Sufyani's army into the earth is a certain sign of reappearance of Mahdi. In addition to above-mentioned hadith of Ja'far Sadiq, in a hadith Ali ibn Abi Talib mentions that Sufyani's army will sink into the earth, and be swallowed up, in the land of Bayda.