Prosecutors said father-of-nine Edward Meenan was subjected to a “vicious” attack last November in the city’s Creggan Street area.
Details emerged as bail was granted to one of three men charged with murdering the 52-year-old.
Derek Cresswell, 27, of no fixed abode, is allegedly connected by blood found on a T-shirt and shoes.
According to a Crown lawyer CCTV footage also put him in the area of the killing on November 25.
A previous court heard Mr Meenan was attacked after a number of men emerged from a house in the area.
When the victim’s body was found in an alleyway he was wearing boxer shorts, with multiple injuries and slice marks detected.
Opposing bail today, prosecution barrister Natalie Pinkerton said: “There were at least 42 stab wounds to the deceased.
“It was a vicious attack on this male; anyone capable of carrying out such an attack would be a risk of re-offending.”
Cresswell mounted a bid to be released from custody after bail was given to one of his co-accused, Sean Rodgers, 31, from the Little Diamond area of Derry.
Counsel representing Cresswell argued that the evidence against him is less significant.
Ian Turkington said his client had been staying at a house close to the attack, providing an explanation for any forensic link without being involved as part of a joint enterprise.
Granting bail, Mr Justice Colton acknowledged: “This was a truly horrendous crime.”
But based on the time Cresswell has spent in custody and the release of his co-accused, the judge ruled that it would be unfair to refuse his application.
He ordered the defendant to live under curfew at an address outside Derry.
Mr Justice Colton also banned him from entering the city.