This Linux Tool Makes Terminal Recording Easy

2 days ago 3

Looking for a speedy mode to grounds your Linux terminal without going done the hassle of utilizing full-blown surface recorders? asciinema is what you're looking for, and I'll amusement you however to get started with it.

What is asciinema?

asciinema is simply a command-line instrumentality for signaling your terminal. Unlike accepted surface recorders, which request immoderate archetypal setup to grounds your instrumentality screen, asciinema does it differently. It records your terminal league successful a peculiar format. You tin replay the signaling straight connected the terminal and stock it with others.

Something that seemed rather absorbing to maine is that the signaling you prevention is not a video. Instead, erstwhile you play it, asciinema replicates what you did connected the terminal with text. So, for example, if you tally a circumstantial acceptable of commands, those commands volition beryllium typed and tally successful the terminal automatically, replicating your actions.

However, it's conscionable a ocular replication. Those commands won't really beryllium tally connected the strategy again. It volition conscionable look to you that those commands are being run.

Another important happening to cognize is that asciinema doesn't nutrient immoderate video files. The full constituent of asciinema is to debar dense video files. Instead, it produces asciicast files ending with a .cast extension. If you truly request a video, past you tin either usage a accepted surface recorder similar SimpleScreenRecorder oregon person the .cast record to a GIF oregon different video format.

Installing asciinema connected Linux

The easiest mode to instal asciinema connected Linux is to usage the Python pipx bundle manager. This is besides the recommended mode due to the fact that it'll ever instal the latest released version. For this method, you'll archetypal request to install pipx connected your Linux system. After that, simply tally this command:

pipx instal asciinema
Installing asciinema connected  Linux utilizing pipx.

Once installed, effort to cheque its mentation to corroborate the installation.

asciinema --version

If you don't privation to instal pipx, past you tin usage different bundle managers arsenic well. For example, connected Debian, Ubuntu, and their derivative distros, run:

sudo apt instal asciinema

You tin besides usage the PPA maintained by David Adam for Ubuntu.

sudo apt-add-repository ppa:zanchey/asciinema

sudo apt update

sudo apt install asciinema

On Arch and Manjaro, you request to run:

sudo pacman -S asciinema

On Fedora, use:

sudo dnf instal asciinema

If you're utilizing Gentoo, run:

sudo look -av asciinema

For openSUSE users, the bid is:

sudo zypper instal asciinema

If you similar to physique bundle from source, you tin bash that arsenic well. All you person to bash is clone the GitHub repository and tally asciinema from there.

git clone https:
cd asciinema
git checkout main
python3 -m asciinema

Recording a Basic Terminal Session Using asciinema

To grounds a speedy terminal league utilizing asciinema, run:

asciinema rec test.cast

We utilized rec bid with the sanction of the signaling record that the league volition beryllium saved in. This volition commencement the recording. So, aft moving the supra command, commencement doing thing connected the terminal for it to beryllium recorded. Once you're done recording, you tin either deed Ctrl+D oregon benignant exit and property Enter to decorativeness the recording.

After finishing the recording, you'll find test.cast oregon immoderate record sanction you utilized successful the existent directory.

Recording a terminal league   utilizing asciinema.

Once you've finished the recording, you tin play it connected your terminal utilizing asciinema. Run:

asciinema play test.cast
Replaying a terminal league   recorded utilizing asciinema.

Related

Screen Recording successful Linux with SimpleScreenRecorder

Recording your Linux desktop is simply a overmuch sought aft feature, for some gamers and concern professionals alike.

As you tin see, the commands you ran during the signaling volition beryllium rerun connected the terminal visually. While the replay is running, you tin intermission and resume the signaling utilizing Space. You tin besides power the playback velocity utilizing the --speed oregon -s option. To play the formed successful doubly the speed, run:

asciinema play -s 2 test.cast

If you privation to halt the playback, deed Ctrl+C connected your keyboard. One happening that stood our to maine astir asciinema is that you tin besides chopped immoderate idle clip from the recording. You tin bash it portion playing the formed oregon earlier you grounds it. This makes the signaling overmuch much enjoyable to watch. To bash this, we walk the --idle-time-limit oregon -i option.

asciinema rec -i 2 demo.cast # For recording
asciinema play -i 2 demo.cast # For playing the recording

Another enactment you person is to stock your formed via asciinema. The upload bid successful asciinema lets you stock it with others done the asciinema.org server.

asciinema upload demo.cast
Uploading an asciinema terminal league   to the server.

Once you tally this command, you'll get a concealed nexus successful the terminal. You tin transcript and paste the nexus successful a web browser to presumption your terminal recording. Note that you'll request an relationship with them to presumption the session. You'll besides person to nexus your relationship with the asciinema CLI instrumentality to sphere your recordings connected the server. Otherwise, they'll beryllium automatically deleted aft 7 days.

Exploring Advanced Features

We've seen the basal commands you tin usage with asciinema. There's a batch much you tin bash with it. Let's dive a spot deeper into the commands you've already seen.

For signaling a session, you tin prime a bid that you privation to grounds alternatively of the full terminal. For instance, let's accidental you privation to grounds the htop command. For that, you person to usage the --command oregon -c option, similar this:

asciinema rec -c htop test.cast

It volition commencement signaling the htop bid interface alternatively of the full shell. To decorativeness recording, you request to exit htop by pressing q. While recording, you tin intermission and resume the recording, conscionable similar you tin portion signaling successful a existent camera. For that, usage Ctrl+\. This is utile erstwhile you person thing confidential connected the terminal that you'd similar to skip.

A screenshot of Nvidia ShadowPlay, the logo successful  the center, and the Linux mascot beside it.

Related

ShadowPlay for Linux? Make Screencasts With GPU Screen Recorder

This instrumentality for signaling games is conscionable arsenic bully but built for Linux.

In summation to playing a session, you tin besides dump the full league output to the terminal. For that, you person the feline option. So from the earlier example, let's dump test.cast.

asciinema feline test.cast
Dumping a signaling  done by asciinema to the terminal.

You tin besides prevention the bid series successful an output file.

asciinema feline existing.cast >output.txt # Or run
asciinema rec --raw output.txt
Saving an asciinema recorded league   arsenic  a substance   file.

You tin besides dump aggregate recordings unneurotic utilizing a azygous command.

asciinema feline first.cast second.cast third.cast

asciinema besides supports an authentication system. If you person an relationship connected asciinema.org, you tin hindrance that with your CLI utilizing the auth command.

asciinema auth
asciinema authentication strategy   successful  display.

You're fixed a link. When you sojourn it, you're taken to a login portal. Once you successfully log in, it volition authenticate your section strategy utilizing that account. After that, you tin sphere each your recordings connected the server.

asciinema has a configuration record that you tin usage to alteration immoderate settings. Keyboard shortcuts are 1 of them. Create a config record successful the $HOME/.config/asciinema/config directory. There are a batch of options to explore. Here's an illustration record you tin follow:

[api]
url = https:

[record]
command = /bin/bash -l
stdin = yes
env = SHELL,TERM,USER
idle_time_limit = 2
yes = true
quiet = true
pause_key = C-p
add_marker_key = C-x
prefix_key = C-a

[play]
speed = 2
idle_time_limit = 1
pause_key = p
step_key = s
next_marker_key = m

[notifications]
enabled = no
command = tmux display-message "$TEXT"

You tin besides acceptable situation variables related to asciinema. The ASCIINEMA_API_URL adaptable defines URL for the asciinema server. By default, it's acceptable to https://asciinema.org. If you're self-hosting the server, you tin acceptable the basal URL to your ain server.

Another utile adaptable is ASCIINEMA_CONFIG_HOME. This 1 defines the way of the configuration file. The default is $HOME/.config/asciinema. However, if you person XDG_CONFIG_HOME set, past it's default worth is $XDG_CONFIG_HOME/asciinema.

You tin embed asciinema recordings connected your website too. Once you upload a formed connected the asciinema server, you tin embed it connected the website utilizing the JavaScript

The root is disposable connected the server wherever you uploaded the recording. Just click the "Share" fastener and transcript the JavaScript embed line.

Different sharing options for an uploaded asciinema cast.

Some Fun Ways to Use asciinema

If you spell to the research leafage connected the authoritative website, you'll spot however antithetic radical are creatively utilizing asciinema to grounds amusive stuff. For instance, there's a Star Wars illustration successful the documentation. You tin usage different fun Linux commands with it. For example, to marque the league a spot much colorful, you tin usage lolcat. You tin bash ASCII creation and grounds it. The sky's the bounds erstwhile it comes to utilizing asciinema.


There's overmuch much to research astir asciinema. If you're funny successful seeing what other you tin do, cheque retired the official documentation. Also, if you're looking for a surface signaling tool, determination are galore Linux screencasting tools available.

Read Entire Article