When we write an article, we use commands to demonstrate how to use certain tools. Often, it is a display of static commands. If you want dynamic commands, you can only record the interface into a GIF through the screen recording tool. However, when the command runs for a long time, the recording time will be longer, the GIF will be larger, and uploading will not be convenient. Is there a better way? Here I will introduce text recording, also called command line recording. The file size is around 10 kb. The artifact is asciinema
First, let’s take a look at the effect:
You can see that the command runs the same as the recorded video, but it is not a video, so you can try to copy the code in the demo.
Installation
Centosyum install asciinemaUbuntu/Kaliapt-get install asciinema
Login
The login of asciinema is different from the traditional account password. It only requires one email address to enable personal login. Execute the command asciinema auth to generate a URL. Copy URL On the browser, enter your email address, and the system will send a certified URL. Open the email and click the URL to activate it.
Using
Enter the command in the terminal
asciinema rec #Start recording When the command input is completed, click ctrl + d or exit to exit to exit the recording. Press Enter to upload the file. There will be a connection successfully. The effect of clicking on the connection is as follows
Click to share, there are many sharing forms, as follows
It is even more necessary to embed the corresponding code.
Of course, it can also be saved directly to the local area. The command is as follows:
asciinema rec kali.cast #Record file
asciinema play kali.cast #play file
asciinema upload kali.cast #Upload file
Turn to GIF
Some special circumstances, such as the WeChat official account cannot play external links, and can only be displayed through GIF. Therefore, we can convert the generated cast file into GIF installation asciicast2gifdocker pull asciinema/asciicast2gif conversion GIFdocker run --rm -v $PWD:/data asciinema/asciicast2gif -S demo.cast demo.gif
Recommended Comments