[Discuss] Logging commands typed - quick and dirty
michaelj at epcc.ed.ac.uk
Thu Jul 31 11:33:09 EDT 2014
Occasionally the challenge of providing attendees with a log of the commands
typed by the instructor has raised its head .
Last week, some attendees at Cranfield got a bit lost due to limited screen
real estate caused by large fonts. Commands went off the screen when run. So I
wanted to look again at providing a live log of the commands typed as a
reminder for attendees and helpers (but not a replacement for the latter nor an
excuse not to go at a suitable pace).
Why not just use the online lessons or instructor notes? These don't take into
account me typing the wrong command by mistake, or the right command in the
wrong location, and the attendees doing this too, and then requiring us to
recover; or deviating from notes to answer attendee questions.
A quick and dirty solution is to use the bash PROMPT_COMMAND. Setting this to:
$ export PROMPT_COMMAND="history > history.txt"
dumps the history into history.txt upon every bash command (yes, it's
inefficient but not brutally so - on the plus side it means the history
numbers are available and so provides a point of reference).
If you do your instructing on a host with web server space then just dump it
$ export PROMPT_COMMAND="history > /home/michaelj/html/history.txt"
and give the attendees the URL e.g.:
If using GitBash and Windows you can dump it into Google Drive or DropBox and
make the file publicly available:
$ export PROMPT_COMMAND="history > /c/Users/mjj/Google\
$ export PROMPT_COMMAND="history > /c/Users/mjj/Dropbox/Public/history.txt"
and give the attendees the associated URL. There is some lag due to the
Like I said, quick and dirty. Use it or not.
PS I know that Trevor has done a script to render a typescript live  which
handles both inputs and outputs and which serves the script at a URL, but here
I just wanted the inputs, and not to have to run my own web server.
 [Tutors] HTML typescript for shell sessions
 [Discuss] Easy way to record and share your terminal
 [Discuss] web-log for the shell
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
More information about the Discuss