I've been on Linux for more than 6 months now but never went too much into the CLI (command-line interface or terminal or shell)
Now as I ask questions here, get answers, or help from other sites, I learn new commands...
How can I can store every new command in a text file? Only new/*unique* commands, not repetitions of the same command.
Here's an example:
In the terminal, I enter the commands like this-
ubuntu@ubuntu:~$ *command1*
ubuntu@ubuntu:~$ *command2*
ubuntu@ubuntu:~$ *command3*
ubuntu@ubuntu:~$ *command4*
ubuntu@ubuntu:~$ *command1*
Now, these commands should get saved in a text file say commandrec like this-
*command1*
*command2*
*command3*
*command4*
NOTE:The last command in the terminal which was again command1 is not recorded/saved again in the text file.
And the next time I open the terminal, and enter a new command command 5, it should get appended to the list in commandrec
(but if the command was used earlier on some other date, it should still be ignored. For example, command 1 entered again along with command 5 on a new day/time but command1 not recorded as already used)
The commandrec file looking something like this-
31/05/12 12:00:00
*command1*
*command2*
*command3*
*command4*
01/06/12 13:00:00
*command 5*
(the time and date thing would be great if possible, but okay even if that isn't there)
This way, I can have a record of all commands used by me to date.
How can this be done?