1

I would like to keep not just history of my commands, but the output as well. If I type ls then it should append to a file
~/Desktop% ls
test.jpg
file.txt
whatever.pdf

Is there anything like that? Or should I try and code this with preexec() and all that?

2
  • A couple questions. Do you want to be able to distinguish between information provided in stdin, from stdout and stderr? Or do you literally just want a log of the text exactly as it is displayed in the virtual terminal, with no inherent ability to distinguish between data output by a program on stdout/stderr and data keyed into the terminal via the keyboard or other stdin device? Sep 25, 2012 at 13:48
  • yep. just like saving what I see in the terminal.
    – pvinis
    Sep 26, 2012 at 23:53

2 Answers 2

1

I used a spyshell. A shell that just runs script, and that opens zsh. I cannot find the link, so I made a gist. Here it is: https://gist.github.com/3791646

1

Have a look at the script utility, which is pretty ancient and should come preinstalled on most UNIX flavours or Linux distros.

Entering script session.log at the shell prompt will drop you into a subshell while recording everything you do — both input and output — to the plaintext file session.log. Typing ^D will exist the subshell (as usual).

See the script(1) man page for more details.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .