Born into slavery in Edenton, NC in 1813, Linda has happy years as a young child with her brother, parents, and maternal grandmother, who are relatively well-off slaves in good positions. It is not until her mother dies that Linda even begins to understand that she is a slave. At the age of six, she is sent to live in the big house under the extended care of her mother's mistress, who treats her well and teaches her to read. After a few years, this mistress dies and bequeaths Linda to a relative. Her new masters are cruel and neglectful, and Dr. Flint, the father, takes an interest in Linda. He tries to force her into a sexual relationship with him when she comes of age. The girl resists his entreaties and maintains her distance.
Knowing that Flint will do anything to get his way, as a young woman Linda consents to a relationship with a white neighbor, Mr. Sands, hoping he can protect her from Flint. As a result of their relations, Sands and Linda have two mixed-race children: Benjamin, often called Benny, and Ellen. Because they were born to a slave mother, they are considered slaves, under the principle of partus sequitur ventrem, which had been part of southern slave law since the 17th century. Linda is ashamed, but hopes this illegitimate relationship will protect her from assault at the hands of Dr. Flint. Linda also hopes that Flint would become angry enough to sell her to Sands, but he refuses to do so. Instead, he sends Linda to his son's plantation to be broken in as a field hand.
When Linda discovers that Benny and Ellen are also to be sent to the fields, she makes a desperate plan. Escaping to the North with two small children would be nearly impossible. Unwilling either to submit to Dr. Flint's abuse or abandon her family, she hides in the attic of her grandmother Aunt Martha's cabin. She hopes that Dr. Flint, believing that she has fled to the North, will sell her children rather than risk having them escape as well. Linda is overjoyed when Dr. Flint sells Benny and Ellen to a slave trader secretly representing Sands. Promising to free the children one day, Sands assigns them to live with Aunt Martha. Linda becomes physically debilitated by being confined to the tiny attic, where she can neither sit nor stand. Her only pleasure is to watch her children through a tiny peephole.
Mr. Sands marries and is elected as a congressman. When he takes the slave girl Ellen to Washington, D.C., to be an eventual companion for his newborn daughter, Linda realizes that he may never free their children. Worried that he will eventually sell them, she determines to escape with them to the North. But Dr. Flint continues to hunt for her, and leaving the attic is still too risky.
After seven years in the attic, Linda finally escapes to the North by boat. Benny remains with Aunt Martha. Linda tracks down Ellen, by then nine years old and living in Brooklyn, New York, in the home of Sandsâ cousin, Mrs. Hobbs. Linda is dismayed to see Ellen is being treated as a slave, after the institution was abolished in New York. She fears that Mrs. Hobbs will take Ellen back to the South and put her beyond her mother's reach. Linda finds work as a nursemaid for the Bruces, a family in New York City who treat her very kindly.
Learning that Dr. Flint is still in pursuit, Linda flees to Boston, where she is reunited with her son Benny, who had also escaped. Dr. Flint claims that the sale of Benny and Ellen was illegitimate, and Linda is terrified that he will re-enslave her and her children. After a few years, Mrs. Bruce dies. Linda spends some time living with her children in Boston. She spends a year in England caring for Mr. Bruce's daughter, and for the first time in her life enjoys freedom from racial prejudice. When Linda returns to Boston, she sends Ellen to boarding school. Benny moves to California with Linda's brother William, who had also escaped to the North. Mr. Bruce remarries, and Linda takes a position caring for their new baby. Dr. Flint dies, but his daughter, Emily, writes to Linda to claim ownership of the fugitive slave.
The Fugitive Slave Act of 1850 is passed by Congress, making Linda and her children extremely vulnerable to capture and re-enslavement, as it requires cooperation by law enforcement and citizens of free states. Emily Flint and her husband, Mr. Dodge, arrive in New York to capture Linda. When the refugee goes into hiding, the new Mrs. Bruce offers to purchase her freedom. At first Linda refuses, unwilling to be bought and sold again, and makes plans to follow Benny to California. Mrs. Bruce buys Linda's freedom from Flint. Linda is grateful to Mrs. Bruce, but expresses disgust at the institution that required such a transaction. Linda notes that she has not yet realized her dream of making a home with her children.
The book closes with two testimonials to its accuracy, one from Amy Post, a white abolitionist, and the other from George W. Lowther, a black anti-slavery writer.

Question: How long did Linda live in the attic of her grandmother?
Answer: seven years.
Alternative answer: 7 years.