Skip to content

Instantly share code, notes, and snippets.

@lalyos
Last active October 19, 2022 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lalyos/94cef8ca8bb3087387312f7f3e775e3b to your computer and use it in GitHub Desktop.
Save lalyos/94cef8ca8bb3087387312f7f3e775e3b to your computer and use it in GitHub Desktop.
Recording bash's standard out

If you want to store all stdout while runing an interactive bash:

Install

curl -Lo /usr/local/bin/cybash https://gist.githubusercontent.com/lalyos/94cef8ca8bb3087387312f7f3e775e3b/raw/cybash
chmod +x /usr/local/bin/cybash

Usage

> cybash

... start bashing as usual

all stdout is saved into timestamped terminal-XXX.log files

One-liner

actually you don't even need 2 lines

bash --rcfile <( echo 'PS1="RECORD> "') > >(tee /tmp/terminal-$(date +%m%d-%H%M).log)
exec 1> >(tee /tmp/terminal-$(date +%m%d-%H%M).log)
bash --rcfile <( echo 'PS1="RECORD> "')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment