Connor McIntosh, 21, a prisoner at Perth, was jailed for a year after admitting knife offences.
McIntosh appeared from custody at Dundee Sheriff Court.
He admitted that, at Transform, Soapwork Lane, on September 11 last year, he behaved in a threatening or abusive manner likely to cause fear or alarm, repeatedly shouted and swore at staff, struck his head against a reception wall, threatened to cut himself and repeatedly struck his own arm with a knife, and possession of a knife.
McIntosh also admitted possession of a knife in the communal area at Strathmore Lodge, Salvation Army hostel, Ward Road, on December 12.
Sheriff Alastair Brown told McIntosh there was no alternative to a custodial sentence.