The Prophet ﷺ took the bath of Janaba. (sexual relation or wet dream). He first cleaned his private parts with his hand, and then rubbed it (that hand) on the wall (earth) and washed it. Then he performed ablution like that for the prayer, and after the bath he washed his feet.
أَنَّ النَّبِيَّ ﷺ اغْتَسَلَ مِنَ الْجَنَابَةِ فَغَسَلَ فَرْجَهُ بِيَدِهِ ثُمَّ دَلَكَ بِهَا الْحَائِطَ ثُمَّ غَسَلَهَا ثُمَّ تَوَضَّأَ وُضُوءَهُ لِلصَّلاَةِ فَلَمَّا فَرَغَ مِنْ غُسْلِهِ غَسَلَ رِجْلَيْهِ