Keiron Walton, aka Hampson, 30, of Oxford Street, Preston, admitted affray after the incident on February 28.
Preston Crown Court heard he was heavily intoxicated and causing a disturbance to his neighbours in the communal corridor of the supported living facility where they all lived.
Resident Richard Priestley repeatedly asked him to go back to his flat, but raging Hampson called him racist names and provoked an argument, during which Priestley punched him.
Moments later Hampson banged on his door telling him: "You've f***ed up now", and when he looked through the spyhole he saw Hampson with a knife in his hand.
The resident got an iron to protect himself before he opened the door.
He twice asked Hampson, who also had a glass in his hand, to go away.
Sentencing him, Judge David Potter said: " You pointed the knife at Mr Priestley.
"You were swaying and slurring your words, and moved forward, which has led to Mr Priestley using the iron to knock the knife out of your hand."
Police were contacted, and Hampson was arrested.
But in an interview he mostly answered: “Can’t remember” to most of the questions, on account of consuming alcohol and prescribed drugs.
The court heard he has convictions going back to when he was a teenager, including four of possessing a blade in public.
Judge Potter added: "The offence is aggravated by your previous convictions, it was prolonged and was committed whilst under the influence of alcohol, and you were also subject to a court order.
"The matter is further aggravated by the use of racial language towards the complainant."
He ordered the knife and glass to be forfeited.