Well the first one appears when his father comes and tells Hamlet of the crime committed by Claudius and tells him he should take revenge on his father's killer! Hamlet then resolves to put on an act of madness in order to fool everyone and find out who the killer is. However, another is when Hamlet is taken over by his madness and torments Gertrude about her marriage towards Claudius and his father intervenes. He tells Hamlet to leave her because God will punish her for her deeds, and tells Hamlet not to lose focus of the main objective. Then Hamlet leaves her and continues on his plans to kill Claudius...however he stretches this for the entire play.
These are only two of the four commands which the ghost tells his son. The other two are: Leave his mother to heaven- Which means not to bother her because she might not know the real truth and secondly-even if she knows what is going on...he must leave her to the heaven or God who will punish her for her deeds. The last command is: Don't taint your mind! Which might be intrepreted for not to do something fully and to keep his purpose and not change it and not to do wrong actions.
Please correct me if I am wrong about this!
In Act I Sc.5, the Ghost of Hamlet's father leads Hamlet away separately from his two friends Marcellus and Horatio and reveals to him in the strictest confidence how he had been murdered by his brother Claudius. The Ghost's main purpose in talking to Hamlet is to request Hamlet to revenge his murder by Claudius: "Revenge his foul and most unnatural murder."
The Ghost tells the shocked and bewildered Hamlet that he has come from Purgatory to meet him personally to reveal to him the treachery of his uncle Claudius. The Ghost describes in graphic detail how Claudius poured a vial of poison into his ear when he was enjoying his customary siesta and murdered him, consequently his soul was consigned to Purgatory because he did not have the opportunity to confess his sins and be absolved of them.The Ghost also tells Hamlet how Claudius seduced his wife, that is his mother, and after his death how he married her. The Ghost sums up his tragedy in the following lines:
"Thus was I, sleeping, by a brother's hand
Of life, of crown, of queen, at once dispatch'd."
The Ghost hurriedly makes its exit because of the approaching dawn telling Hamlet never to forget all that it had just told him: "Adieu, adieu! Hamlet, remember me."
As soon as the Ghost leaves, Hamlet is dazed but soon pulls himself together and is determined to carry out the Ghost's command to revenge his treacherous murder by his wicked brother Claudius. Hamlet soliloquizes that henceforth he will erase from his mind the memories of his youthful pastimes and pleasures and all what he has learnt and stored in his mind as a scholar. He swears fiercely that he is determined to remember and remember only one thing, that is the Ghost's command to kill Claudius and avenge his father's murder:
'Yea, from the table of my memory
I'll wipe away all trivial fond records,
All saws of books, all forms, all pressures past,
That youth and observation copied there;
And thy commandment all alone shall live
Within the book and volume of my brain,
Unmix'd with baser matter: yes, by heaven!"
A little later his friends, Horatio and Marcellus arrive. After having sworn them to secrecy he tells them that he is going to pretend to be a mad man and that they should not mind his strange behaviour. Hamlet has decided to put on "an antic disposition" in order to hide his true feelings towards his mother and his uncle and to bide his time for an opportune moment to kill Claudius. He has decided to pretend to be mad in order not to arouse the suspicions of Claudius who will be watching him closely as Hamlet is the real heir to the throne.