How can I take the input and the output of a terminal? To be more specific, what I want to do is to take everything that is typed in the terminal, and everything that the "terminal" types (in real time).
script should be what you are looking for (man page).
Start a logged session with
script /path/to/your/logfile, every command and its output will be logged into the logfile.
If you need timing info for a realistic replay, use
script -t=/path/to/your/timingfile /path/to/your/logfile. Afterwards, you can replay the log using
scriptreplay /path/to/your/timingfile /path/to/your/logfile.
Copy/paste method usually works for simple input/output.
In case you'd like to monitor what's going on within another terminal window try tmux.
You may find more here