5

When I am teaching a class, some students have problems following my CLI commands and would like to scroll back to be able to repeat the steps in their own speed. So I'd like to log all my inputs in realtime to an html-file or something similar, which I could server through a webserver. That way, the students could simply go to http://example.com/log#end and would always see the last entries.

I do know the multiuser mode of screen and have already used it to share sessions. However, I need to disable the write access of students and unfortunately, they are unable to scroll up, if I do so.

I also had a look at script, but it generates a terrible output, which - even when filtered through col -bp < logfile >> output.html is unreadable. Also, it does log the output as well, which complicates things and only dumps the logfile in unforeseeable intervals.

.bash_history could be used, but is only dumped to file when the session ends.

Any ideas?

5
  • 1
    This blog entry have a extended description on how it can be done Perhaps the method of this answer could be used askubuntu.com/questions/80371/…
    – jhilmer
    Feb 10, 2014 at 21:44
  • wow, very big solution. I might be able to adapt it to my needs and might use it in another scenario as well, thanks. I'll wait for a simpler solution before accepting it, though. ;)
    – Lars
    Feb 10, 2014 at 21:47
  • I use Adobe Captivate when I want to give out instructions. (You can create some advanced guides, when you learn how to manage the application)
    – BD Bear
    Feb 10, 2014 at 22:33
  • Do you want ALL keyboard input, or input specifically for bash? You said bash, but global keygrabbing is easier. Something to think about. Feb 10, 2014 at 22:40
  • Hm, might also be a possibility. In this specific case, I just need bash.
    – Lars
    Feb 12, 2014 at 13:09

1 Answer 1

5

Use the built-in command history:

history -w hist.txt

will save the current history into file hist.txt.

If you have write permsiions to the appropriate directory you could do something like:

history -w /var/www/html/latest_history.txt

Then your students could access it in a browser: http://teachers.ip.address/latest_history.txt

1
  • User @Lars (who has insufficient rep to comment) comments: ----- This is a great answer. I ended up using the following to update it every few seconds while (true); do history -w /var/www/history.txt sleep 3 done
    – Jos
    Jul 22, 2014 at 20:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.