Nathan Harold (37), who attacked the man during a row at a central Dublin tram stop, had let a cocaine and tablets addiction "get the better of him", a court heard.
Harold, of Ratoath Avenue, Finglas, pleaded guilty to assault, as well as separate charges including public order offences.
Dublin District Court heard the assault happened on April 23 at James's Luas stop.
Gardaí were called to an incident where Harold had assaulted a security guard.
The court heard he had been in an altercation with the man and struck him in the head and face.
Harold had left the area when gardaí arrived.
The accused was identified on CCTV and was later arrested. The victim did not require any treatment.
On January 1 last year, gardaí were called to the Spire Hostel on Marlborough Street, where Harold was acting aggressively after being told he was no longer welcome there.
He was in an intoxicated state and was escorted off the premises, but became threatening and abusive outside, starting to spit and lash out at gardaí before being arrested.
He stole a bag at McDonald's, O'Connell Street Upper on April 20, 2018, when the victim left it behind. It was not recovered and contained property worth €478.
On March 9 that year, he kicked and damaged a door at the Granby Centre, Granby Row. The value of the damage was €100.
Harold also admitted shoplifting sunglasses and instant tan at a pharmacy in the north city on May 8, 2018.
He had previous convictions.
The court heard there was no victim impact statement in relation to the assault.
Harold had worked in construction and as a forklift driver but developed an addiction to cocaine and tablets at a young age and it affected his ability to retain employment.
The court was told Harold's addiction "got the better of him", his barrister said, and he had to leave the family home.
He now wanted to get away from the city and people he was associating with.
Harold was already in custody serving another sentence when he appeared in court.
Judge Smyth made the six months consecutive to that sentence.