Skip to content

Instantly share code, notes, and snippets.

@laetrid
Last active August 29, 2015 14:26
Show Gist options
  • Save laetrid/e080800c28dec0a448af to your computer and use it in GitHub Desktop.
Save laetrid/e080800c28dec0a448af to your computer and use it in GitHub Desktop.
man script
To record all new bash sessions:
Add:
test "$(ps -ocommand= -p $PPID | awk '{print $1}')" == 'script' || (script -t 2> $HOME/shell_logs/$(date +"%Y-%m-%d_%H%M%S").timing -f $HOME/shell_logs/$(date +"%Y-%m-%d_%H%M%S").log)
to $HOME/.bashrc
And create directory $HOME/shell_logs/
script record all terminal characters including control, color, etc
to view *.log file, you can use:
less -r <filename>.log
Although you can replay your session with:
scriptreplay <filename>.timing <filename>.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment