Hacking thy self. Sharing some productivity tips that I use ..
The first tip involves the bash shell; my workaround for one of the annoyances and turning it into a feature.
Don’t know about you, but by the end of every day I usually have about a dozen terminals running. Waking up the next day or maybe Monday, I’d like a quick recap of what I was working on (and how) to jump into the zone on what I was doing.
The “history” feature of bash is great, except there is only one file. The $HOME/.bash_history file only saves the history for the last shell logging out. Great, so just keep all the terminal sessions going, right? Yes, except that you’re often logged in remotely, or say your notebook needs a reboot to install some new updates. Yuk.
Save Everything Chronologically
The first step for the solution is saving everything you do that day chronologically. I have a directory structure set up with: $HOME/wfm/%Y/%m/%d and an alias to get there quickly.
alias today='mkdir -p $HOME/wfm/`date +%Y/%m/%d` && cd $HOME/wfm/`date +%Y/%m/%d`'
All my notes, temporary files that I’m working on that day will be stored there. Easy to find what I was working on the previous day, last week or a year ago.
The second part of the solution is another alias and a few lines in your $HOME/.bash_logout file.
twiggy:~$ grep dhist .aliases alias dhist='history >> history.$$' twiggy:~$ cat .bash_logout today dhist echo Bye! twiggy:~$ today twiggy:~/wfm/2018/12/23$ dhist twiggy:~/wfm/2018/12/23$ ls -l hist* -rw-r--r-- 1 bduncan staff 45385 Dec 23 10:28 history.364 -rw-r--r-- 1 bduncan staff 40935 Dec 23 10:28 history.381 -rw-r--r-- 1 bduncan staff 41109 Dec 23 10:29 history.400 -rw-r--r-- 1 bduncan staff 40798 Dec 23 10:28 history.413
Using this, the history lines for all your sessions are saved when logging out. Of course, you should dump your history locally using “dhist” if you’re leaving the sessions going at the end of the day.
Use this technique to get into your zone quickly every morning!