Loneliness can be temporary or longterm. One should read biographies of prisoners & solitary confinement. They would do anything to kill loneliness, some would form unique friendships with a person whom they cannot see, imaginary friends, prison guards etc.
Like many things in life, we are not prepared for loneliness. The easiest way is to keep our minds occupied. When I travel alone to new places, What I do is to space out the day's work, have a coffee break, a long lunch, walk around the place, do some window shopping so that I don't return to the room soon. Even if I do, I sit in the lounge for some time. I carry some family videos and pictures that I can browse through.
If it's for a longer time, then we need to organize ourselves to reduce the time alone as much as we can. Morning trips to buy milk and paper, a visit to the temple, a visit to buy groceries (small amounts enough for a couple of days), cleaning and clearing our house clutter. We need to make friends with neighbors or walking mates at the park or join simple groups (reading, tea, library, laughing clubs).
Renewing interest in a hobby, reading books, a creative class, helping others with our skills (teacher, bank officer), developing online friends and joining an educational site like ISC would be some options.