An easy way to do this is start a “script” session using a nifty program called script.
It basically puts you in a virtual terminal and records everything you type and the corresponding output.

script -a /home/user/bashlog.txt

Then just type exit when you want to stop logging.

Mario Loria is a builder of diverse infrastructure with modern workloads on both bare-metal and cloud platforms. He's traversed roles in system administration, network engineering, and DevOps. You can learn more about him here.