Bereshit / Genesis 42:8 · Drash
וַיַּכֵּר יוֹסֵף אֶת־אֶחָיו וְהֵם לֹא הִכִּרֻהוּ׃
And Yosef recognised his brothers, but they did not recognise him.
Drash דְּרָשׁ
Write down every name
How did Yosef find his brothers among crowds of buyers from every land? The midrash tells of guards at the gates and of how Yosef at once let them know he knew their past.
Tanchuma: Yaakov told his sons to enter the city by different gates, to avoid the evil eye. Yosef set guards at all the gates and had each man's name and his father's name written down. So he found his brothers. And to Shimon and Levi he said: "you are used to plundering people, as you did in Shechem."
How Midrash Tanchuma (Buber) explain it
Midrash Tanchuma (Buber)
"And Yosef's ten brothers went down." Yaakov said to them: I beg you, do not enter by one gate, because of the evil eye. And so they did: when they entered, they did not all enter together, but each one by himself. What did Yosef do? He set guards at the gates of Egypt and said: the name of everyone who enters and his father's name shall be written down with you, and bring me their names. And when the sons of Yaakov entered, each one by himself, the guard would say: "What is your name?" And he would say: "Reuven son of Yaakov." And so each of them wrote his name and his father's name. And they brought the writings to Yosef. He said to them: go and bring them. They went and found them in the street of the harlots and brought them to Yosef. At once Yosef recognised them, as it is said: "and Yosef recognised his brothers". He began to remember the dreams, as it is said: "and Yosef remembered the dreams that he had dreamed of them". "And he made himself a stranger to them and spoke harshly with them": he began to be hard with them and said to them: "Where have you come from?" When they said "from the land of Canaan", he said to Shimon and Levi: "you are used to plundering people, as you did in Shechem." That is "and he spoke harshly with them".
Takeaway
The midrash explains why the brothers were in the harlots' street: elsewhere it says they were searching there for Yosef, thinking a handsome slave might have been sold there (Bereshit Rabbah 91:6).
Shimon and Levi destroyed the city of Shechem over their sister Dinah (34:25). Yosef shows he knows of it, and the brothers grow more afraid.
Yaakov feared the "evil eye": ten strong, handsome brothers together draw attention. The midrash puts this at the start of the story as the reason they had to be found through the records.