كتاب الحج
15  
The Book of Pilgrimage
(55)
Chapter: Shaving the head is preferrable to cutting the hair, although cutting the hair is permissible
(55)
باب تَفْضِيلِ الْحَلْقِ عَلَى التَّقْصِيرِ وَجَوَازِ التَّقْصِيرِ ‏‏
Sahih Muslim 1301 b

Abdullah b. Umar (Allah be pleased with him) reported Allah's Messenger (ﷺ) as having observed:

O Allah, have mercy upon those who get their heads shaved. They (the Companions) said: Messenger of Allah, (what about those) who have got their hair clipped? He said: O Allah, have mercy upon those who have got their heads shaved. They (again) said: Allah's Messenger, (what about those) who have got their hair clipped? Thereupon he said: (O Allah, have mercy upon those) who have got their hair clipped.
وَحَدَّثَنَا يَحْيَى بْنُ يَحْيَى، قَالَ قَرَأْتُ عَلَى مَالِكٍ عَنْ نَافِعٍ، عَنْ عَبْدِ اللَّهِ بْنِ عُمَرَ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم قَالَ ‏"‏ اللَّهُمَّ ارْحَمِ الْمُحَلِّقِينَ ‏"‏ ‏.‏ قَالُوا وَالْمُقَصِّرِينَ يَا رَسُولَ اللَّهِ قَالَ ‏"‏ اللَّهُمَّ ارْحَمِ الْمُحَلِّقِينَ ‏"‏ ‏.‏ قَالُوا وَالْمُقَصِّرِينَ يَا رَسُولَ اللَّهِ قَالَ ‏"‏ وَالْمُقَصِّرِينَ ‏"‏ ‏.‏
Reference : Sahih Muslim 1301b
In-book reference : Book 15, Hadith 349
USC-MSA web (English) reference : Book 7, Hadith 2984
  (deprecated numbering scheme)