Command Line Cinema
The Ruby tool Shelr transforms the command line into a motion picture, and you can even copy the commands to the clipboard.
The Ruby tool Shelr transforms the command line into a motion picture, and you can even copy the commands to the clipboard.
Do blockbusters elicit a yawn? Does the command line excite you with further possibilities? Do you want to direct your own film starring Linux commands instead of kids, cats, and dogs? Then, Shelr is what you need.
The Shelr [1] program is implemented in Ruby and is licensed under GPLv3. Shelr allows you to capture command-line activity in the form of a video and either archive it as a memory aid or share it with others in a tutorial or talk. You can use the Shelr.tv [2] online service to host your screen videos in the best YouTube manner (Figure 1). Shelr.tv is better than YouTube because it lets you extract content from the stream and copy-and-paste it into the console.
You can set up Shelr in no time, and many distributions already feature it in their repositories. If Shelr is missing from your distro's repository, as is the case with Debian "Squeeze," simply install Ruby and RubyGems and then get Shelr, along with its dependencies, from the Ruby repository by issuing the following command:
$ sudo gem install shelr
Shelr requires few commands, making it easy to learn. In the background, Shelr uses the script utility from the util-linux or util-linux-ng packages to record the terminal session, acting as a front end that manages your masterpieces and sets up the connection with Shelr.tv. Then, Shelr and script fork to shell and send their output to a TypeScript file that you can play back or print out later.
Shelr resides in the default directory /var/lib/gems/version_no/bin , which is not normally in the path. The following command can help with that:
$ export PATH=/var/lib/gems/version_no/bin:$PATH
Entering the same export line in the ~/.bashrc file works, and you don't have to expand the variable in the future.
To use Shelr to record terminal input, all you need is the shelr record command. The program prompts you for a title for your recording and then lets loose (Figure 2). The software logs all input and saves the data in a TypeScript file in the ~/.local/share/shelr/<ID>/typescript directory. When all is said and done, end the process with exit or Ctrl+D. The shelr play last command is for playback.
If you're happy enough with the result to share your work with others, you can enter the shelr push last command to push it to Shelr.tv. The program asks you to add a meaningful description. If no errors occur when uploading, the software displays the URL of the published TypeScript file.
Naturally, you don't have to publish your creations on Shelr.tv. You can keep your collection for yourself and share it with friends and family. If you use Shelr regularly, you will begin to amass a large collection of videos.
If the TypeScript filename format, which is based on Unix timestamps, makes it difficult to find a video from the past, the shelr list command can help; it lists the title of the video. Copy the ID of the desired title into the shelr play ID command, or use the shelr push ID command to push the video to Shelr.tv (Figure 3).
Even hardworking filmmakers sooner or later become curious about the work of others. You can view videos from other filmmakers at the Shelr.tv web page. If the browser is bothersome or a graphical environment is missing, use the following command to extract the video and start the playback:
$ shelr play http://shelr.tv/records/ID_no.json
The push command makes it possible to publish works as an anonymous user. To get some renown for your shell casting, you need an API key, which you get rather easily through an account with GitHub, Twitter, Google, or OpenID. It's as easy as registering with one of these services on Shelr.tv (Figure 4). Follow up by getting an API key with shelr setup Key , and your videos will then be associated with your nickname.
If you don't want to use Shelr.tv, you can also use the API to associate the script with a URL. If you're hesitant to share your work with the common masses, add the --private option when using push . In this case, the viewer also needs an access key, along with the public ID, to enjoy the video (Figure 5). The Shelr.tv server renders the uploaded recordings into JSON objects. (To do this locally, use the dump command.)
Shelr isn't limited to the script program as a back end. You can change the back end (to ttyrec , for example) with the following command:
$ shelr setup recorder backend ttyrec
Mac OS X provides an outdated version of script that isn't compatible with Shelr, so in the case of Mac OS, ttyrec is currently the only solution.
Shelr not only records off the terminal but also provides the opportunity to enrich it with sound. Enter the record --sound command to create a parallel audio file in the OGG format.
With Shelr, it is easy to record, reproduce, and publish the output of terminal procedures. The biggest advantage of Shelr over an ordinary screen recording tool is that you can copy-and-paste commands from a playback session.
A shell cast is useful locally as a memory or training tool, but you can also upload scripts through services such as Shelr.tv. Shelr also lets you add audio to the script. The Shelr.tv online service is free software, which means you can even feature shell casts on your own website.
Infos