How can you know that meditating isn't selfish?
But if you define the 'self' as your inner core/soul is it still possible to meditate selfish?


One purpose of meditation is to deepen your understanding for anatta, non-self. Meditating as intended, one develops a different view on the self than the definition above, for instance.


  If so how to know this and how to prevent this?


On one hand - among other things - one needs to familiarize oneself with the theoretical concepts of:


the twelve nidanas, for general understanding on how wrong view leads to suffering
bhava tanha, for specific understanding of wrong striving for defining a self
the five skandhas, for right understanding of a wholesome alternative to defining a self


On the other hand, to prevent that our insights stays a mere theoretical product, we must also examine how these phenomena plays out in real life, with the aid of:


right mindfulness, in order to recognize when we falsely identify with a certain concept of self
right effort, to explore new habits allowing us to break the patterns creating more suffering, and to develop habits conducive to the cessation of suffering