I had tried to do it on logout, but .{bash,zsh}_logout turned out to be unreliable, so now I do it on logon:<p>1. Save your history!<p>Unless you have an insanely long history length set (and by default, you really won't), that one off command you never think you're going to need again? You're going to need it. And all those commands you typed after it will push it out of history and it's gone forever.<p>So, in your .{bash,zsh}rc, do something like<p><pre><code> cp .histfile histories/$(date).histfile
</code></pre>
Name it however you like. There are ways to avoid duplication and saving excessive amounts, but I'll leave that up to you.<p>2. tmux/GNU screen<p>For some reason I can't stand tabbed terminal windows, and use a multiplexer. Plus tmux's scrolling is a little easier to use that a mousewheel.<p>3. zsh<p>If you chose zsh over bash, you get easier to use expansion tools, for example, the equivalent of basename in bash is<p><pre><code> ${FILE##*/}
</code></pre>
in zsh<p><pre><code> ${FILE:t}
</code></pre>
Helpful in scripting and the like.