The phrase to know —— like the back of one’s hand means to know —— thoroughly or perfectly, to know —— inside out.
The earliest quotation in the Oxford English Dictionary (2nd edition, 1989) is from Wall of Eyes: A Detective-Inspector Sands Murder Mystery (Dell Publishing Company – New York, 1943), by the American-Canadian author of mystery novels Margaret Ellis Millar (née Sturm – 1915-94).
I have, however, found earlier instances of the phrase.
The earliest are from David Balfour. Being Memoirs of his Adventures at Home and Abroad (1893), by the Scottish novelist, poet and travel writer Robert Louis Stevenson (1850-94):
– In chapter 12, as published in several U.S. newspapers on Sunday 29th January 1893, for example, in The Seattle Post-Intelligencer (Seattle, Washington)—Alan Breck Stewart says to David Balfour:
“Thanks to Johnny Cope and other red-coat generals, I should ken this country like the back of my hand.”
– In chapter 28, as published in several U.S. newspapers on Sunday 2nd April 1893, for example in The Sun (New York City, N.Y.)—David Balfour says to James MacGregor Drummond:
“I know you like the back of my hand.”
The second-earliest instance that I have found is from Captain Grace: America’s Champion Life Saver, published in The Dallas Morning News (Dallas, Texas) of Sunday 13th July 1902; this article was about Captain Irving Grace, who ferried passengers from the foot of East One Hundred and Twenty-Fifth street to Ward’s Island, New York City, and had saved eighty-nine persons from drowning over the course of forty-seven years:
And the Captain, besides, knows this particular stretch of water, as the saying goes, like the back of his hand.
Its earlier form was connaître —— comme ses poches, to know —— like one’s pockets.
The earliest occurrence of this earlier form was discovered by the French lexicographer Pierre Enckell (1937-2011) in a French Revolutionary periodical dating from 1791, written under the pseudonym of Jean Bart:
[as quoted in Matériaux pour l’histoire du vocabulaire français: Datations et documents lexicographiques – Deuxième série, Volume 32 (Klincksieck – Paris, 1989)]
C’est un vieux routier qui connoît toutes les ruses de guerre comme ses poches.
He is an old hand who knows all the stratagems like his pockets.
The second-earliest recorded instance is from Madame Angot, au sérail [= seraglio] de Constantinople, drame, tragédie, farce, pantomime, en trois actes, orné de tous ses agremens (Paris, 1800), by the French playwright Joseph Aude (1755-1841):
– Madame Angot. (elle apperçoit Bramen.) Qui que je vois là ? qui que je vois là ?… C’est-i ben lui ?… C’est lui, je ne me trompe pas.
– Le Pacha. C’est elle.
– Bramen. Oui, Madame Angot, c’est moi, c’est Bramen.
– Le Pacha. Elle le connaît.
– Madame Angot. Tiens, si je le connais ! comme mes poches.
– Madame Angot. (she sees Bramen.) Who do I see there? who do I see there?… Is it really him?… It’s him, I am not mistaken.
– The Pasha. It’s her.
– Bramen. Yes, Madame Angot, it’s me, it’s Bramen.
– The Pasha. She knows him.
– Madame Angot. If I know him! like my pockets.