To find the partition, use the command:
$ df
The output will be something like below. In this case, the SD card is on /dev/mmcblk
(ignore the two partitions).
Filesystem Size Used Avail Use% Mounted on
udev 7.8G 0 7.8G 0% /dev
tmpfs 1.6G 2.5M 1.6G 1% /run
/dev/nvme0n1p3 263G 36G 214G 15% /
tmpfs 7.8G 817M 7.0G 11% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup
/dev/nvme0n1p2 515M 110M 406M 22% /boot/efi
tmpfs 1.6G 16K 1.6G 1% /run/user/118
tmpfs 1.6G 76K 1.6G 1% /run/user/1000
/dev/mmcblk0p1 253M 52M 201M 21% /media/jlam/boot
/dev/mmcblk0p2 15G 3.3G 11G 24% /media/jlam/rootfs
Execute the following to copy the SD card to an image file.
$ sudo dd if=/dev/mmcblk0 of=pi-backup.img status=progress