...have the system log all the commands and responses to a file
command with arguments > file OR
command with arguments >> fileThe latter appends to the end of the file, which is useful for an ongoing log. The former replaces the file so that it only contains the output of the last time the command ran.
OR
command with arguments | tee fileThat one pipes (|) the command's output to tee's input, and all tee does is copy its input to its own output and to that file.
Also, there are actually *two* outputs, stdout for normal output and stderr for errors, and the terminal catches both. Redirection and pipes, however, only catch stdout. To get both, you need to redirect stderr to the same place, like this:
command with arguments 2>&1 | tee file That sends the original stream 2 (stderr) to the same place as the original stream 1 (stdout), and then does the redirection.
(They're separate so that you can do some preliminary filtering by sending them to different places, provided of course that each command follows that convention. The built-in utilities do, but a freshman project probably doesn't.)
There are TONS of utilities like that (
cat and
grep are often useful across a pipe...), and even more if you
apt install moreutils. Once you have that, you can do
command | ts >> file, which puts a timestamp on each line.
man x to see in detail what
x does and how to tweak it.
None of these record the command though, only the output. The only way I know to capture the commands too is to set the terminal's scrollback way high and then copy/paste after it's done. (Ctrl-C is not copy, and Ctrl-V is not paste, inside the terminal. Those have other meanings, like "stop the running program". A lot of terminals use Ctrl-Shift-C/V for copy/paste, which isn't too far different, but you still have to remember. Or if you're unsure, you can use the right-click menu.)
But even with that, it still won't echo the commands from inside a script, like Windows does. You'd need to modify the script, like I do with some of mine, to explicitly print what it's about to do before it does it.