Final answer:
Ulysses S. Grant was the commanding general of the Union army during the last years of the Civil War.
Step-by-step explanation:
The commanding general of the Union army during the last years of the Civil War was Ulysses S. Grant. He played a crucial role in the Union victory by leading a series of successful campaigns, including the siege of Vicksburg and the Appomattox Campaign that culminated in the surrender of Confederate General Robert E. Lee. Grant's strategic thinking and willingness to engage the Confederates in battle proved instrumental in turning the tide of the war in favor of the Union.