A quick command to clone a SD card (not tested on flash drive but should work):
Note: Your iso image will be as large as your SD card/Flash drive. View the Compressed Clone Image section below if you need a smaller file.

cat /dev/sdc/ > /home/username/Downloads/backup.iso

Quick command to clone an ISO file back to the SD card:

sudo sh -c 'cat /home/username/Downloads/backup.iso > /dev/sdb; sync'

If you don’t know the device location then run this command to find your device:

fdisk -l

Compressed Clone Image

Command to create compressed image:

dd if=/dev/sdc status=progress | gzip -c > /home/username/Downloads/backup.img.gz

Command to put image on sd card or flash drive:

gunzip -c /home/username/Downloads/backup.img.gz | dd of=/dev/sdc status=progress

Permission Denied

When testing the above commands to put the image back onto the SD card or flash drive I kept getting a permission error.

I ran this command to drop into the root shell:
**Use at your own risk!

sudo -i

When the copy is complete type exit

References:
https://unix.stackexchange.com/questions/492773/compressing-and-decompressing-dd-image-zstd-instead-of-gzip
https://askubuntu.com/questions/227924/sd-card-cloning-using-the-dd-command
https://askubuntu.com/questions/752513/error-creating-bootable-usb-using-cat-file-iso-dev-sdb