How can I record the screen (or screencast) in text mode?

Basically I want to capture the process of installing a driver in Ubuntu so I can watch it later.

There are screen capture applications such as SimpleScreenRecorder, but they won't work in text mode because there is no display driver when I stop LightDM.

There is also fbcat which lets us take screenshots in textmode, but I wonder if there is something I can use to screencast when I switch to Ctrl+Alt+F2?


Solution 1:

Asciinema

If you want to go youtube style, look at asciinema. You can install it using:

sudo apt install asciinema

To get a more recent version if you are not on 18.04 yet, you can either use this ppa:

sudo apt-add-repository ppa:zanchey/asciinema
sudo apt update
sudo apt install asciinema

or use the pip method:

sudo apt install python3-pip
pip3 install asciinema --user

(see also: How to install pip (python) to user without root access)

Now start a recording session using

asciinema rec output.cast

which will drop you in another shell. Recording will last until you exit this shell. You can play the result using:

asciinema play output.cast

Beware! If you start asciinema rec without providing an output file name, it will default to uploading the recorded session to asciinema.org and returning just a URL. You can cancel before, but it's easy to miss that point.

Solution 2:

You can use script to save everything printed or typed in the terminal.

From the script manpage:

DESCRIPTION

   script makes a typescript of everything displayed on your terminal.  It
   is useful for students who need a hardcopy  record  of  an  interactive
   session  as  proof  of  an  assignment.  

To use script:

script termout.txt

This will save all the screen contents to "termout.txt". Type exit to stop script