User Tools

Site Tools


wiki:record_terminal_sessions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
wiki:record_terminal_sessions [2022/01/07 11:35] – created antisawiki:record_terminal_sessions [2023/06/05 12:35] (current) – [See also] add Play multigigabyte asciinema recordings antisa
Line 15: Line 15:
  
   apt install asciinema   apt install asciinema
 +
 +Then put this at the end of //.bashrc// to automatically record session when terminal is opened:
  
   test "$(ps -ocommand= -p $PPID | awk '{print $1}')" == 'sh' || (asciinema rec $HOME/Documents/terminal_logs/$(date +"%d-%b-%y_%H-%M-%S").cast)   test "$(ps -ocommand= -p $PPID | awk '{print $1}')" == 'sh' || (asciinema rec $HOME/Documents/terminal_logs/$(date +"%d-%b-%y_%H-%M-%S").cast)
  
 +To open the recording in the browser download [[https://github.com/asciinema/asciinema-player/releases/download/v3.0.0-beta.4/asciinema-player.css|css]] and [[https://github.com/asciinema/asciinema-player/releases/download/v3.0.0-beta.4/asciinema-player.min.js|javascript]] file. Save this html file as //asciinema_player.html// and change the path to the  cast file (example below uses path ///07-sij-22_13-45-24.cast//.
 +
 +<code html>
 +<html>
 +<head>
 +
 +  <link rel="stylesheet" type="text/css" href="asciinema-player.css" />
 +
 +</head>
 +<body>
 +
 +  <div id="demo"></div>
 +
 +  <script src="asciinema-player.min.js"></script>
 +  <script>
 +    AsciinemaPlayer.create('/07-sij-22_13-45-24.cast', document.getElementById('demo'), {fit: 'both'});
 +  </script>
 +</body>
 +</html>
 +</code>
 +
 +Then run
 +  python3 -m http.server
 +in the directory where you downloaded the above files and in your browser visit http://localhost:8000/asciinema_player.html
 +
 +You can control the look of the player by passing some options to the //AsciinemaPlayer.create// constructor in html file. See [[https://github.com/asciinema/asciinema-player#api|API examples]]
 ===== python program TermRecord ===== ===== python program TermRecord =====
  
Line 28: Line 56:
  
 ====== See also ====== ====== See also ======
 +  * [[Play multigigabyte asciinema recordings]]
 ====== References ====== ====== References ======
   * https://asciinema.org   * https://asciinema.org
wiki/record_terminal_sessions.1641555343.txt.gz · Last modified: 2022/01/07 11:35 by antisa

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki