By James Cooley - July 26 2007 tags: linux

Bash history is useful for documenting what you've done but it only gets saved when you exit gracefully. Ssh timeouts cause you to loose history which is a pain if you wanted document the sequence of commands you used to configure something. I mentioned this to andrewg and he suggested using screen. Screen sessions survive even if ssh times out so you don't loose any history. Pretty useful. It's "screen" to start a session and "screen -dr" to rejoin the session later.

The last time I used screen was in the 90s when someone showed me how to setup an environment while we were on different continents - I joined his screen session and watched him type while on a conference call - aah the days before screencasts. There's quite a bit you can do with screen.

PS My favorite bash shortcut is C-r (reverse-i-search) which matches the last command in your history as you type - it's worth installing cygwin for that convenience alone.