One day , when Ali Baba was in the forest , he saw a troop of men on horseback , coming toward him in a cloud of dust . He was afraid they were robbers , and climbed into a tree for safety . When they came up to him and dismounted , he counted forty of them . They unbridled their horses and tied them to trees . The finest man among them , whom Ali Baba took to be their captain , went a little way among some bushes , and said : `` Open , Sesame ! '' -LRB- 1 -RRB- so plainly that Ali Baba heard him . A door opened in the rocks , and having made the troop go in , he followed them , and the door shut again of itself . They stayed some time inside , and Ali Baba , fearing they might come out and catch him , was forced to sit patiently in the tree . At last the door opened again , and the Forty Thieves came out . As the Captain went in last he came out first , and made them all pass by him ; he then closed the door , saying : `` Shut , Sesame ! '' Every man bridled his horse and mounted , the Captain put himself at their head , and they returned as they came . -LRB- 1 -RRB- Sesame is a kind of grain . Then Ali Baba climbed down and went to the door concealed among the bushes , and said : `` Open , Sesame ! '' and it flew open . Ali Baba , who expected a dull , dismal place , was greatly surprised to find it large and well lighted , hollowed by the hand of man in the form of a vault , which received the light from an opening in the ceiling . He saw rich bales of merchandise -- silk , stuff-brocades , all piled together , and gold and silver in heaps , and money in leather purses . He went in and the door shut behind him . He did not look at the silver , but brought out as many bags of gold as he thought his asses , which were browsing outside , could carry , loaded them with the bags , and hid it all with fagots . Using the words : `` Shut , Sesame ! '' he closed the door and went home .
Then he drove his asses into the yard , XXXXX the gates , carried the money-bags to his wife , and emptied them out before her .
Using browsing came catch concealed heard loaded saw shut thought