One place for hosting & domains

      Sessions

      Comment enregistrer et partager des sessions de terminal en utilisant Terminalizer sur Ubuntu 18.04


      L’auteur a choisi Electronic Frontier Foundation pour recevoir un don dans le cadre du programme Write for DOnations.

      Introduction

      Terminalizer est une application d’enregistrement de terminal qui vous permet d’enregistrer votre session de terminal en temps réel, puis de la lire ultérieurement. Elle fonctionne de la même manière qu’un enregistreur d’écran de bureau, mais fonctionne dans votre terminal.

      L’enregistrement de votre session de terminal est utile si vous voulez revoir une activité particulière, ou pour aider à déboguer une erreur particulièrement délicate. Les enregistrements réalisés avec Terminalizer peuvent également être exportés sous forme de GIF animés, ce qui est idéal pour le partage en ligne ou l’ajout de contenu marketing pour votre logiciel.

      Dans ce tutoriel, vous allez installer Terminalizer, l’utiliser pour enregistrer et lire des sessions de terminal, personnaliser vos enregistrements, puis les exporter pour les partager en ligne.

      Conditions préalables

      Pour suivre ce tutoriel, vous aurez besoin de :

      Si vous souhaitez partager vos enregistrements en ligne, vous aurez également besoin de :

      Une fois que tout cela est prêt, connectez-vous à votre serveur en tant qu’utilisateur non root pour commencer.

      Étape 1 – Installation de Terminalizer

      Dans cette étape, vous allez télécharger et installer Terminalizer sur votre système. Terminalizer est écrit en utilisant Node.js, et peut être installé en utilisant le gestionnaire de paquets npm.

      Pour installer Terminalizer sur votre système, exécutez la commande suivante :

      • sudo npm install --global --allow-root --unsafe-perm=true terminalizer

      Terminalizer utilise le framework d’application Electron pour exporter des sessions de terminal enregistrées en format GIF. L’argument de commande --unsafe-perms=true est nécessaire afin d’installer Electron sur votre système d’une manière globale.

      Une fois Terminalizer installé, vous verrez une sortie semblable à ce qui suit :

      Output

      . . . /usr/local/lib └── terminalizer@0.7.1

      Ensuite, vérifiez l’installation de Terminalizer en exécutant :

      Une sortie semblable à celle-ci s’affichera :

      Output

      0.7.1

      Enfin, générez un fichier de configuration Terminalizer par défaut, que vous pouvez utiliser pour la personnalisation avancée de Terminalizer (plus détaillée à l’étape 4) :

      Cela donnera un résultat similaire à ce qui suit :

      Output

      The global config directory is created at /home/user/.terminalizer

      Maintenant que vous avez installé Terminalizer, vous pouvez effectuer votre premier enregistrement de terminal.

      Étape 2 – Enregistrement et Lecture d’une session de terminal

      Dans cette étape, vous allez enregistrer et lire une session de terminal.

      Pour commencer, configurez un nouvel enregistrement Terminalizer en utilisant le nom de votre choix :

      • terminalizer record your-recording

      Cela donnera la sortie suivante pour indiquer que l’enregistrement a démarré :

      Output

      The recording session has started Press Ctrl+D to exit and save the recording

      Vous pouvez maintenant continuer à faire tout ce que vous voulez dans votre terminal. Chaque pression de touche et commande sera enregistrée en temps réel par Terminalizer.

      Par exemple :

      • pwd
      • date
      • whoami
      • echo "Hello, world!"

      Lorsque vous souhaitez arrêter l’enregistrement, appuyez sur CTRL+D. Terminalizer sauvegardera ensuite l’enregistrement dans le fichier spécifié au format YAML, par exemple, your-recording.yml.

      Output

      Successfully Recorded The recording data is saved into the file: /home/user/your-recording.yml

      Vous pouvez être invité par Terminalizer à partager votre enregistrement en ligne. Appuyez simplement sur CTRL+C pour annuler ce partage pour l’instant, car vous pouvez lire l’enregistrement de terminal localement pour commencer.

      Ensuite, lisez la session de terminal enregistrée avec la commande suivante :

      • terminalizer play your-recording

      Cela rejouera la session enregistrée en temps réel dans votre terminal :

      Output

      user@droplet:~$ pwd /home/user user@droplet:~$ date Sun Mar 8 14:55:36 UTC 2020 user@droplet:~$ whoami user user@droplet:~$ echo "Hello, world!" Hello, world! user@droplet:~$ logout

      Vous pouvez également ajuster la vitesse de lecture de votre enregistrement en utilisant l’option --speed-factor.

      Par exemple, ce qui suit jouera votre enregistrement deux fois plus lentement (50 % de la vitesse) :

      • terminalizer play your-recording --speed-factor 2

      Vous pouvez aussi lire votre enregistrement deux fois plus vite (200 % de la vitesse) :

      • terminalizer play your-recording --speed-factor 0.5

      Vous avez enregistré et lu votre session de terminal. Maintenant, vous pouvez partager en ligne une session de terminal enregistrée.

      Étape 3 – Partage d’une session de terminal enregistrée

      Dans cette étape, vous allez partager votre session de terminal enregistrée sur la page Terminalizer Explore.

      Commencez par sélectionner la session enregistrée que vous souhaitez partager :

      • terminalizer share your-recording

      Vous serez ensuite invité à fournir quelques métadonnées basiques sur votre enregistrement, telles que son titre et sa description :

      Output

      Please enter some details about your recording ? Title Title of Your Recording ? Description Description of Your Recording ? Tags such as git,bash,game Comma-separated Tags for Your Recording

      Attention : les enregistrements de Terminalizer sont partagés publiquement par défaut, assurez-vous qu’il n’y a pas de détails d’identification personnelle ou confidentiels que vous ne voulez pas partager dans votre enregistrement de terminal.

      Si c’est la première fois que vous partagez une session enregistrée à l’aide de Terminalizer, vous devrez lier votre compte Terminalizer. Terminalizer affichera un lien de vérification si nécessaire :

      Output

      Open the following link in your browser and login into your account https://terminalizer.com/token?token=your-token When you do it, press any key to continue

      Attention : assurez-vous que votre jeton Terminalizer est bien privé, car il permettra à quiconque en sa possession d’accéder à votre compte Terminalizer.

      Une fois que vous avez visité le lien dans votre navigateur Web et que vous vous êtes connecté à votre compte Terminalizer, appuyez sur n’importe quelle touche pour continuer.

      Terminalizer va maintenant télécharger votre enregistrement et vous fournir le lien pour le visualiser :

      Output

      Successfully Uploaded The recording is available on the link: https://terminalizer.com/view/your-recording-id

      Visiter le lien dans un navigateur Web de bureau vous permettra de visualiser votre enregistrement partagé :

      Une capture d'écran du site Web de Terminalizer, montrant un exemple d'enregistrement de terminal partagé

      Vous avez partagé une session de terminal enregistrée sur le site Web de Terminalizer et l’avez consultée dans votre navigateur Web.

      Étape 4 – Définition de la configuration avancée de Terminalizer

      Maintenant que vous connaissez un peu Terminalizer, vous pouvez commencer à utiliser certaines des options de personnalisation les plus avancées, telles que la possibilité d’ajuster les couleurs et le style de l’affichage.

      Chaque enregistrement hérite de la configuration par défaut du fichier de configuration global de Terminalizer, qui est situé dans ~/.terminalizer/config.yml. Cela signifie que vous pouvez modifier la configuration pour les enregistrements individuels directement en modifiant le fichier d’enregistrement (par exemple  : your-recording.yml). Vous pouvez également modifier la configuration globale, ce qui aura un impact sur tous les nouveaux enregistrements.

      Dans cet exemple, vous allez modifier le fichier de configuration globale, mais ces instructions s’appliquent également aux fichiers de configuration d’enregistrements individuels.

      Commencez par ouvrir le fichier de configuration globale de Terminalizer dans votre éditeur de texte, par exemple nano :

      • nano ~/.terminalizer/config.yml

      Chacune des options de configuration disponibles dans le fichier est commentée afin d’expliquer ce qu’elle fait.

      Il existe plusieurs options de configuration courantes que vous souhaiterez peut-être adapter à votre convenance :

      • cols : fixe explicitement le nombre de colonnes de terminal utilisées pour votre enregistrement.
      • rows : fixe explicitement le nombre de lignes de terminal utilisées pour votre enregistrement.
      • frameDelay : ignore le délai entre chaque frappe pendant la lecture.
      • maxIdleTime : spécifie un temps maximum entre les frappes pendant la lecture.
      • cursorStyle : précise le style de curseur de terminal par défaut entre block, bar et underline.
      • fontFamily : spécifie une liste de polices de lecture préférées, dans l’ordre de préférence.
      • theme : ajuste le schéma de couleurs de la lecture, par exemple pour créer un terminal noir sur blanc, etc.

      Par exemple, vous pouvez réaliser un affichage de terminal blanc sur noir en configurant les options suivantes :

      config.yml

      . . .
      theme:
        background: "white"
        foreground: "black"
      . . .
      

      Cela donnera un résultat similaire à ce qui suit :

      Une capture d'écran du site Web de Terminalizer, montrant un exemple d'enregistrement avec un thème noir sur blanc

      Vous pouvez ajuster le style du curseur pour rendre l’enregistrement plus facile à comprendre, par exemple en remplaçant le curseur de style block par défaut par un curseur souligné de type underline :

      config.yml

      . . .
      cursorStyle: underline
      . . .
      

      Cela donnera un résultat semblable à ce qui suit :

      Une capture d'écran du site Web de Terminalizer, montrant un exemple d'enregistrement avec un curseur de type underline

      Une fois que vous avez apporté les modifications souhaitées, enregistrez le fichier et retournez dans votre terminal.

      Si vous avez modifié la configuration globale de Terminalizer, ces paramètres s’appliqueront à tous les nouveaux enregistrements à venir. Si vous modifiez une configuration d’enregistrement spécifique, Terminalizer appliquera immédiatement les changements à cet enregistrement en particulier.

      Notez que le style de lecture personnalisé ne s’applique qu’aux sessions d’enregistrement partagées. Si vous lisez un enregistrement directement dans votre terminal, vous utiliserez toujours le style et la palette de couleurs de votre terminal par défaut.

      Dans cette dernière étape, vous avez passé en revue certaines des options de configuration avancées pour Terminalizer.

      Conclusion

      Dans cet article, vous avez utilisé Terminalizer pour enregistrer et partager une session de terminal. Vous avez maintenant les connaissances nécessaires pour créer des démonstrations enregistrées de votre logiciel à utiliser dans du contenu marketing ou pour partager des astuces en ligne de commande avec des amis.

      Si vous souhaitez rendre et exporter des enregistrements Terminalizer au format GIF, vous pouvez installer Terminalizer sur une machine avec une interface utilisateur ou un bureau graphique et utiliser les fonctions de rendu intégrées :

      Vous pouvez également naviguer sur le site Web de Terminalizer pour voir les sessions de terminal enregistrées et partagées par d’autres utilisateurs :



      Source link

      How To Record and Share Terminal Sessions Using Terminalizer on Ubuntu 18.04


      The author selected the Electronic Frontier Foundation to receive a donation as part of the Write for DOnations program.

      Introduction

      Terminalizer is a terminal recorder application that allows you to record your terminal session in real-time, and then play it back at a later date. It works in the same way as a desktop screen recorder, but instead runs in your terminal.

      Recording your terminal session is useful if you want to review a particular activity again, or to help debug a particularly tricky error. Recordings made with Terminalizer can also be exported as animated GIFs, which are great for sharing online or adding to marketing material for your software.

      In this tutorial, you will install Terminalizer, use it to record and play back terminal sessions, customize your recordings, and then export them to share online.

      Prerequisites

      To complete this tutorial, you will need:

      If you wish to share your recordings online, you’ll also need:

      Once you have these ready, log in to your server as your non-root user to begin.

      Step 1 — Installing Terminalizer

      In this step, you will download and install Terminalizer on your system. Terminalizer is written using Node.js, and is available to install using the npm package manager.

      To install Terminalizer globally on your system, run the following command:

      • sudo npm install --global --allow-root --unsafe-perm=true terminalizer

      Terminalizer uses the Electron application framework to export recorded terminal sessions into GIF format. The --unsafe-perms=true command argument is required in order to install Electron globally on your system.

      Once Terminalizer has been installed, you’ll see similar output to the following:

      Output

      . . . /usr/local/lib └── terminalizer@0.7.1

      Next, check your installation of Terminalizer by running:

      This will display something similar to the following:

      Output

      0.7.1

      Finally, generate a default Terminalizer configuration file, which you can use for Terminalizer’s advanced customization (detailed further in Step 4):

      This will produce output similar to the following:

      Output

      The global config directory is created at /home/user/.terminalizer

      Now that you’ve installed Terminalizer, you can make your first terminal recording.

      Step 2 — Recording and Playing Back a Terminal Session

      In this step, you will record and playback a terminal session.

      To begin, set up a new Terminalizer recording using a name of your choice:

      • terminalizer record your-recording

      This will output the following to indicate that the recording has started:

      Output

      The recording session has started Press Ctrl+D to exit and save the recording

      You can now proceed to do anything that you want within your terminal. Each key press and command will be recorded in real-time by Terminalizer.

      For example:

      • pwd
      • date
      • whoami
      • echo "Hello, world!"

      When you’d like to stop the recording, press CTRL+D. Terminalizer will then save the recording to the specified file in YAML format, for example, your-recording.yml.

      Output

      Successfully Recorded The recording data is saved into the file: /home/user/your-recording.yml

      You may be prompted by Terminalizer to share your recording online. Just press CTRL+C to cancel this for now, as you can playback the terminal recording locally first.

      Next, play your recorded terminal session with the followng command:

      • terminalizer play your-recording

      This will replay the recorded session in real-time in your terminal:

      Output

      user@droplet:~$ pwd /home/user user@droplet:~$ date Sun Mar 8 14:55:36 UTC 2020 user@droplet:~$ whoami user user@droplet:~$ echo "Hello, world!" Hello, world! user@droplet:~$ logout

      You can also adjust the playback speed of your recording using the --speed-factor option.

      For example, the following will playback your recording twice as slowly (half speed):

      • terminalizer play your-recording --speed-factor 2

      Alternatively, you can play back your recording twice as fast (double speed):

      • terminalizer play your-recording --speed-factor 0.5

      You’ve recorded and played back a terminal session. Next, you can share a recorded terminal session online.

      Step 3 — Sharing a Recorded Terminal Session

      In this step, you’ll share your recorded terminal session online on the Terminalizer Explore page.

      Begin by selecting a recorded session to share:

      • terminalizer share your-recording

      You will then be prompted to provide some basic metadata about your recording, such as the title and description:

      Output

      Please enter some details about your recording ? Title Title of Your Recording ? Description Description of Your Recording ? Tags such as git,bash,game Comma-separated Tags for Your Recording

      Warning: Terminalizer recordings are shared publicly by default, so ensure that there are no personally identifiable or confidential details present in your terminal recording that you don’t want to share.

      If this is the first time that you’ve shared a recorded session using Terminalizer, you’ll need to link your Terminalizer account. Terminalizer will display a verification link if this is required:

      Output

      Open the following link in your browser and login into your account https://terminalizer.com/token?token=your-token When you do it, press any key to continue

      Warning: Ensure that you keep your Terminalizer token private, as it will allow anyone in possession of it to access your Terminalizer account.

      Once you have visited the link in your web browser and signed in to your Terminalizer account, press any key to continue.

      Terminalizer will now upload your recording and provide you the link to view it:

      Output

      Successfully Uploaded The recording is available on the link: https://terminalizer.com/view/your-recording-id

      Visiting the link in a desktop web browser will allow you to view your shared recording:

      A screenshot of the Terminalizer website, showing an example of a shared terminal recording

      You’ve shared a recorded terminal session on the Terminalizer website and viewed it in your web browser.

      Step 4 — Setting Advanced Terminalizer Configuration

      Now that you’ve gained some familiarity with Terminalizer, you can begin to review some of the more advanced customization options, such as the ability to adjust the display colors and style.

      Each recording inherits the default configuration from the global Terminalizer config file, which is located at ~/.terminalizer/config.yml. This means that you can edit the configuration for individual recordings directly by editing the recording file (e.g. your-recording.yml). Alternatively, you can edit the global configuration, which will have an impact on all new recordings.

      In this example you’ll edit the global configuration file, but the same guidance applies to individual recording configuration files as well.

      Begin by opening the global Terminalizer configuration file in your text editor, such as nano:

      • nano ~/.terminalizer/config.yml

      Each of the available configuration options within the file are commented in order to explain what they do.

      There are several common configuration options that you may wish to adjust to your liking:

      • cols: Explicitly set the number of terminal columns used for your recording.
      • rows: Explicitly set the number of terminal rows used for your recording.
      • frameDelay: Override the delay between each keystroke during playback.
      • maxIdleTime: Specify a maximum time between keystrokes during playback.
      • cursorStyle: Specify the default terminal cursor style out of block, bar, and underline.
      • fontFamily: Specify a list of preferred playback fonts, in order of preference.
      • theme: Adjust the color scheme of the playback, for example to create a black-on-white terminal, etc.

      As an example, you can achieve a white-on-black terminal display by configuring the following options:

      config.yml

      . . .
      theme:
        background: "white"
        foreground: "black"
      . . .
      

      This will produce a result similar to the following:

      A screenshot of the Terminalizer website, showing an example of a recording with a black-on-white theme

      You could adjust the cursor style to make the recording easier to understand, for example by swapping the default block-style cursor with an underlined one:

      config.yml

      . . .
      cursorStyle: underline
      . . .
      

      This produces a result similar to the following:

      A screenshot of the Terminalizer website, showing an example of a recording with an underline-style cursor

      Once you have made any desired changes, save the file and return to your terminal.

      If you edited the global Terminalizer configuration, these settings will apply to all new recordings going forward. If you’re editing a specific recording configuration, Terminalizer will immediately apply the changes to that particular recording.

      Note that custom playback styling only applies to shared recording sessions. Playing them back directly in your terminal will always use your default terminal styling and color scheme.

      In this final step, you reviewed some of the advanced configuration options for Terminalizer.

      Conclusion

      In this article you used Terminalizer to record and share a terminal session. You now have the knowledge required to create recorded demos of your software for use in marketing material, or to share command-line tricks with friends.

      If you wish to render and export Terminalizer recordings into GIF format, you can install Terminalizer on a machine with a graphical user interface/desktop and use the built-in rendering features:

      You may also wish to browse the Terminalizer website to see recorded terminal sessions shared by other users:



      Source link