Loneliness doesn’t exist in the minds that are free from ignorance and egoism, even when being by oneself alone, without engaging in any personal relationship or friendship or contact with anyone, or without engaging in any forms of mental or physical social interactions and activities, as there is no sense of separateness of time, space and causation in the minds that are selfless/compassionate. The minds are peaceful and contented as they are, being free from clinging onto the existing companionship, love and support from other beings, being free from craving towards the companionship, love and support from other beings that are non-existing in the present, being free from aversion towards the absence of companionship, love and support from other beings in the present, and being free from aversion towards losing the existing companionship, love and support from other beings.
The sense of loneliness and all the other forms of impurities such like separateness, restlessness, dissatisfaction, meaninglessness, emptiness, boredom and all sorts of fear will keep following the egoistic minds that are under the influence of ignorance and egoism, wherever they are and whatever condition they have, even when these minds are having a good life in a good living environment and a good condition of the physical body, and they are surrounded by many other beings, being engaged in different relationships and friendships with many other beings, and being busy with all sorts of worldly mental and physical social interactions and activities, as there are attachment of clinging, craving and aversion in the mind that give rise to the sense of loneliness and all other forms of impurities.
Realize selflessness and be free from ignorance and egoism, being unattached towards the life existence and function of the body and mind that are selfless and subject to impermanence, and being undetermined by any qualities of names and forms that the mind perceives through the senses that are also impermanent, and the mind will be free from loneliness and all other forms of impurities.
Otherwise, the mind ceaselessly looking for or relying on companionship, love and support from other beings to occupy itself with some forms of mental or physical social interactions and activities, to get rid of loneliness, dissatisfaction, boredom, emptiness, meaninglessness and so on. There’s nothing wrong with trying to get rid of loneliness by keeping the mind busy engaging with someone or something, but then the mind will be in a state of restlessness, which it will come to a point where the mind goes wild and couldn’t ‘unwind’ or ‘shut down’ naturally, and affecting the mental and physical health and relationships with everyone in long term. In serious cases, people might hurt themselves and/or others either out of loneliness or restlessness.
For those who are sincere in their yoga practice to ‘know thyself’, to be free from ‘suffering’, who might think that they have a ‘good’, ‘contented’, ‘positive’ and ‘happy’ mind, can try to live alone in solitude and seclusion being isolated from ‘the world’ for a prolong period of time, and one will find out the true state of the mind, or whether the mind is free, or not.