Recover deleted photos from SD card.

Install testdisk application.

$ sudo apt install testdisk
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libvirt-clients libvirt-daemon-system-systemd qemu-kvm
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  testdisk
0 upgraded, 1 newly installed, 0 to remove and 63 not upgraded.
Need to get 362 kB of archives.
After this operation, 1 457 kB of additional disk space will be used.
Get:1 http://pl.archive.ubuntu.com/ubuntu groovy/universe amd64 testdisk amd64 7.1-5 [362 kB]
Fetched 362 kB in 0s (1 051 kB/s)  
Selecting previously unselected package testdisk.
(Reading database ... 254572 files and directories currently installed.)
Preparing to unpack .../testdisk_7.1-5_amd64.deb ...
Unpacking testdisk (7.1-5) ...
Setting up testdisk (7.1-5) ...
Processing triggers for man-db (2.9.3-2) ...

Create work-directory.

$ mkdir sd_card

Insert SD card and execute photorec application.

$ sudo photorec

Select device.

Select partition.

Select filesystem.

Select scan area.

Select output directory.

Watch the recovery process.

Quit the application and inspect recovered files.

Enjoy!