Easiest tool for recoring screen in Linux(Ubuntu) is recordmydesktop tool. It’s easy for installation and usage.
Installation:
$ sudo apt update
$ sudo apt install recordmydesktop
Recording Screen:
$ recordmydesktop --on-the-fly-encoding
--on-the-fly-encoding
encodes the output immediately; without it you need to wait for a possibly long time at the end for the encoding to be done. I haven't seen any significant downsides to that option yet, likely it will just take a bit more of CPU resources, but it is generally worth it.
This will record until you stop the program on the terminal e.g. with Ctrl + C.
Usage(optional)
You can use arguments like key to stop recording like:
$ recordmydesktop --stop-shortcut=Control+s
Using Audio jack
$ recordmydesktop --use-jack system:capture_1