JERUSALEM — The morning of the attack, Subhe Abu Khalifa did not get up for work, telling his mother he was too tired and his feet hurt. He had spent the night watching and rewatching footage of a Palestinian woman, who the Israeli police say stabbed a Jewish man in the back in Jerusalem’s Old City, being harassed and shot.

Instead of going to his job as an apprentice electrician, Mr. Khalifa, 19, sharpened a knife he bought the day before, according to an account friends later gave his brother, then plunged it into an Israeli near Police Headquarters. With that, he joined a cadre of young Palestinians who, spurred on by social media, have independently decided to attack Israelis, killing seven and wounding scores in two dozen episodes since Oct. 1, authorities said.

The violence escalated again on Tuesday, with two deadly outbreaks in Jerusalem, one where the police said two Palestinians tried to commandeer a public bus with a gun.

Three Israelis were killed along with at least two of three Palestinian attackers. Palestinian officials said 30 of their people had been slain this month, mostly after stabbings or in roiling clashes across East Jerusalem and the West Bank, as well as at the border fence separating Israel from the Gaza Strip.