is it permissible for a man to cut his hair inside masjid?
All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
Cutting the hair should not be done inside the mosque, as we are ordained to keep mosques clean and take care of them.
The scholars objected to and forbade cutting hair and cutting nails in the mosque, even if one intends to collect them and throw them outside the mosque once he is done.
Al-Madwwanah reads: Ibn Al-Qasim: “Malik said: The person observing ‘I’tikaf should not cut his nails or his hair in the mosque, and the person who performs Hijamah (cupping) should not enter to cut his hair and nails (the person observing ‘I’tikaf). He [Ibn al-Qasim] said: We said to him [to Imam Malik]: “He will collect that and throw it outside the mosque.” Imam Malik replied: “I dislike that even if he collects it.” [End of quote]
Ibn Al-Hajj said in his book Al-Madkhal:
“Bringing the mirror into the mosque to cut the mustaches and pluck the gray hair and other things which they do; these are innovated matters which are forbidden. This should be prevented in the mosque based the saying of the Prophet : “Put the facilities of purification at the entrances of your mosques [i.e. the places where you perform ablution should be outside the mosque and not inside it].” If ritual purification is forbidden inside the mosque, then how can one bring waste (rubbish) into the mosque or do any kind of craft (or job) in it? We mentioned before that it is forbidden to copy [or print] the Mus-haf (the Arabic hardcopy of the Qur'an) or books of knowledge in the mosque if this is done as a means of earning a living; so what about this type of work and similar matters (jobs). If the hair is cut then it is pure in itself, but it is waste from which the mosque should be free.” [End of quote]
Allah knows best.
You can search for fatwa through many choices