Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 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?

share|improve this question
This blog entry have a extended description on how it can be done Perhaps the method of this answer could be used… – jhilmer Feb 10 '14 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 '14 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 '14 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. – RobotHumans Feb 10 '14 at 22:40
Hm, might also be a possibility. In this specific case, I just need bash. – Lars Feb 12 '14 at 13:09
up vote 5 down vote accepted

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

share|improve this answer
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 '14 at 20:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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