Samuel Blacknell, 31, of Michael Moses Way, Swineshead, received the sentence at Lincoln Magistrates’ Court on Friday.
It followed an incident in Michael Moses Way two days earlier.
At about 3.45pm, a mother and father in their early 30s were walking along the street with their three young children. The father, who was carrying his two-year-old son, then stepped off the pavement to avoid some pedestrians.
Blacknell was riding a bicycle along the road and his bag brushed against the father. He then stopped his bike and pulled out a knife.
He was muttering unknown words and acting in a threatening manner, a police spokesman said.
After cycling off, Blacknell was traced by police and found nearby and arrested.
Insp Alina Ames said: “This was an excellent result following the speedy action of our officers and CPS.”