the itjerk

my adventures with technology

Monthly Archives: October 2019

record terminal commands with script alias

Here’s an incredibly useful command that uses script¬† and alias to record what you’re doing on the terminal. Install something? Update something? Need to remember something? It’s easier than looking at bash_history.

To setup, add the below line to your ~/.bashrc file to create an alias “rec”. Then, the next time you want to remember your terminal commands, type “rec” first to activate script (and “exit” when you’re done), and you’ll have a timestamped file in your Documents directory of your terminal’s output.

 alias rec='script -aq ~/Documents/term.log-$(date "+%Y-%m-%d.%H:%M:%S")'