views:

34

answers:

2

Hi,

I work extensively using the shell. When I continue working on some project one week later, I go to some "folder" and realize that I do not remember what I was doing. Sometimes and before stopping work what I do is:

history  > DIRX_HISTORY_20100922

so later I have a look at the commands I used, I can remember much better what I was doing.

I wonder if somehow, some script or something could do this automatically each time I type a command in a directory, so this DIRX_HISTORY_20100922 is created and a new one is modified depending on the date and on the directory name.

Thanks

+1  A: 

Have a look at my history logging functions. They save the current directory along with the command that was executed. You can grep for the directory and it will show you the commands that you were using there.

Dennis Williamson
A: 

Bash's PROMPT_COMMAND variable can be used to save the last line of your history to a file for every command you enter.

ie.

PROMPT_COMMAND="history 1 >> DIRX_HISTORY"

Burton Samograd
where do you store this, on the .bashrc?
Werner
yes, you could put it in your .bashrc
Burton Samograd