From 7f9de785dfdbd7fe9fb8466354d16739cfe35b70 Mon Sep 17 00:00:00 2001 From: Malin Freeborn Date: Fri, 31 Oct 2025 17:20:37 +0100 Subject: [PATCH] record terminal with script --- vision/record_terminal.md | 71 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 vision/record_terminal.md diff --git a/vision/record_terminal.md b/vision/record_terminal.md new file mode 100644 index 0000000..3db3bf8 --- /dev/null +++ b/vision/record_terminal.md @@ -0,0 +1,71 @@ +--- +title: "Record a Terminal Session" +tags: [ "vision", "share" ] +--- + +Record a terminal command, then press 'Control + d' to exit. + +```sh +script --timing=time.log stat.txt +ls -a +ls -al +stat ~/.bashrc +^D +``` + +Replay the session: + +```sh +scriptreplay --timing=time.log stat.txt +``` + +Try a bare command, without any timing: + +```sh +script -c 'top | lolcat' loltop +nl loltop +``` + +Has your terminal messed up? +Is the cursor hiding? +Reset it! + +```sh +reset +``` +If you can't see any keys, keep typing anyway: have faith in your terminal. + +This `loltop` file will not play properly as it has no timings file. +But you can cheat the system and use your other timings file: + +```sh +scriptreplay --timing=time.log loltop +``` + +This will mostly not work well, but it shows how the timing file works: + + +```text +0.033401 23 +0.044513 8 +0.000016 219 +1.349324 114 +0.179106 1 +0.088790 1 +0.072821 1 +0.358337 2 +0.000254 9 +0.004720 52 +0.000084 21 +0.155462 671 +``` + +I think it works like this? + +| How long it took | to type *n* characters | +|:----------------:|:----------------------:| +| 0.033401 | 23 | +| 0.044513 | 8 | +| 0.000016 | 219 | +| 1.349324 | 114 | +