Joab was one of the three sons of Zeruiah, the sister of King David. His other two brothers were Abishai and Asahel, who was killed by Abner, the commander-in-chief of Saul's army. Joab, himself, was the commander-in-chief of David's army. Joab later treacherously murdered Abner.
Joab then left David and sent messengers after Abner, and they brought him back from the well of Sirah. But David did not know it. Now when Abner returned to Hebron, Joab took him aside into the gateway, as though to speak with him privately. And there, to avenge the blood of his brother Asahel, Joab stabbed him in the stomach, and he died.
(2 Samuel 3:26-27)
Soon after, Joab led the assault at the storming of the fortress on Mount Zion. He also participated in the battles against the allied forces of Syria and Ammon; against Edom; and against the Ammonites.
Joab was a bloodthirsty man, appararently without scruples of any sort. He precipitated the murder of Uriah, Bathsheba's husband, on the instructions of David. He also killed David's rebellious son Absalom as he hung helpless on an oak tree, on this occasion directly disobeying David's instructions to keep the man alive.
David gave the command of the army to Amasa, Joab's cousin, who also met his end at the hands of Joab.
While they were at the great rock in Gibeon, Amasa came to meet them. Joab was wearing his military tunic, and strapped over it at his waist was a belt with a dagger in its sheath. As he stepped forward, it dropped out of its sheath.
Joab said to Amasa, "How are you, my brother?" Then Joab took Amasa by the beard with his right hand to kiss him. Amasa was not on his guard against the dagger in Joab's hand, and Joab plunged it into his belly, and his intestines spilled out on the ground. Without being stabbed again, Amasa died. (2 Samuel 20:9-10)
When David was dying Joab espoused the cause of Adonijah in preference to that of Solomon. He was afterwards slain by Benaiah, by the command of Solomon, in accordance with his father's injunction, at the altar to which he had fled for refuge.
Benaiah succeeded Joab as commander-in-chief of the army.