A file that will record,every(and only) a new command I use?

view story

http://askubuntu.com – I've been on linux for more than 6months now but never went tooo much into CLI. Now as I ask questions here,get answers or other help from other sites,I learn new commands.. I want to knw,is there a way,I can store every new command in a text file.Only a new command should be recorded.If repeated,should be ignored. For example,this is what I want to happen- 1.In the terminal,I enter the commands like this- ubuntu@ubuntu:~$ command1 ubuntu@ubuntu:~$ command2 ubuntu@ubuntu:~$ command3 ubuntu@ubuntu:~$ command4 ubuntu@ubuntu:~$ command1 2.Now,these commands should ge (HowTos)