I want to have a snapshot of all the commands I executed and output (stdout, stderr) in a file to view later. Often I need to view it for debugging purposes.
This link gives the output for single command: How to redirect output to a file and stdout
However, I do not want to write it for each command since it is time consuming. Also, this does not log the command I executed.
Example functionality:
bash> start-logging logger.txt
bash> echo "Hi"
Hi
bash> cat 1.txt
Contents of 1.txt
bash> stop-logging
Contents of logger.txt
bash> echo "Hi"
Hi
bash> cat 1.txt
Contents of 1.txt
Ideally, I want the above behavior. Any other command with some missing functionality (maybe missing command executed from tmp.txt) would also help.