Police had originally believed the weapon was a knuckle duster with a blade attached when they arrested criminal Martin Kenny, 30, of Cemetery Road, Preston.
He later admitted possession of a bladed article and cannabis.
Kenny, who has 42 offences on his record, had his six month jail term suspended for two years after a judge heard he had turned his life around in the 20 months since the offence.
The Honorary Recorder of Preston, Judge Robert Altham, also had to take into account a delay by police in handing over a file to the CPS, which meant he was only charged in July this year - more than a year after the incident.
Preston Crown Court was told Kenny was searched by officers just before noon on March 23, 2019, close to Preston Railway Station, after officers had been called to an unrelated incident close to KFC on Fishergate.
Kenny immediately confessed there was a small bag of cannabis on him, but officers also found the knife.
In an interview he said he had no intention of using it as a weapon, but due to a previous knife conviction, Kenny would ordinarily have faced a mandatory minimum six month jail term.
However, Claire Larton, defending, said he had "changed his ways" and was on a methadone programme to tackle his long standing drug addiction.
She added: "He has now been offence free for over 20 months.
"That is, for this defendant, a significant period of time and is one of the largest gaps in his offending.
Judge Altham said: " If it were to be used as a weapon it would be a ferocious, indeed potentially lethal, weapon."
"You have pleaded guilty at the first opportunity to these offences.
"It's important to remember these matters related to offences committed nearly 20 months ago. The delay is not your fault."
He said his record made "troubling reading" and added: " Members of the public are rightly concerned about people, particularly violent people - and you have shown yourself to be a violent man - walking around the streets with knives, and the courts sadly have the business of trying cases where people on the streets with knives use them and kill each other."
But he ruled it would be unjust to activate the six month jail term in the circumstances. Kenny was given a rehabilitation activity, curfew and drug rehabilitation order.
The Lancashire Post is more reliant than ever on you taking out a digital subscription to support our journalism. For unlimited access to Lancashire news and information online, you can subscribe here.