Ryan Sedgwick, 27, was imprisoned at F wing in Stoke Heath prison, near Market Drayton, and had a dispute with a fellow inmate on that wing.
It came to a head on the morning of February 20 last year when the victim was going to get his medication from the "med hatch", Shrewsbury Crown Court heard on Tuesday.
Prosecutor Miss Naomi Nelson-Cofie told the court that Sedgwick had twisted a pillowcase around a metal plug that had been taken from his cell door and concealed it on his person.
Footage from CCTV in the prison showed Sedgwick approach the victim and swing the weapon at the back of his head.
The other man thought he had been punched and turned around, before Sedgwick hit him again at least twice more.
Sedgwick was detained while the victim was taken to Princess Royal Hospital in Telford – he had a 3cm deep cut to his head which had to be sutured.
The defendant pleaded guilty at the earliest opportunity to assault causing actual bodily harm and possessing a weapon in prison, in contravention of the Prison Act.
His representative at court, Mr Stephen Scully, said that Sedgwick had earlier heard his victim say "today is the day," and took that to be a threat.
Sedgwick felt the best way to avoid future issues was to have either himself or the victim moved away from F wing, said Mr Scully.
He also told the court that Sedgwick has spent "half of his life in and out of custody" and saw himself as "institutionalised" but now wanted to change his ways and be a better partner and father.
Judge Peter Barrie said "This was a weapon capable of breaking bones and doing serious damage.
"It might have done far more harm than it did."
But he noted from interviews between Sedgwick and probation services that there was now a "glimmer of hope" that he could become a law-abiding citizen.
He chose to suspend the sentence, one of 12 months for the assault and four months concurrently for possessing the weapon, for two years.
It meant Sedgwick was released from custody following the hearing.
Sedgwick will also have to carry out 40 rehabilitation activity days and 100 hours of unpaid work.